mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-13 15:47:17 +03:00
Ignored people still show up when they send private /msg
This commit is contained in:
parent
fde04365ac
commit
6fe0b40327
@ -183,6 +183,10 @@ func (m PrivateMsg) To() *User {
|
||||
return m.to
|
||||
}
|
||||
|
||||
func (m PrivateMsg) From() *User {
|
||||
return m.from
|
||||
}
|
||||
|
||||
func (m PrivateMsg) Render(t *Theme) string {
|
||||
s := fmt.Sprintf("[PM from %s] %s", m.from.Name(), m.body)
|
||||
if t == nil {
|
||||
|
@ -89,6 +89,14 @@ func (r *Room) HandleMsg(m message.Message) {
|
||||
}
|
||||
case message.MessageTo:
|
||||
user := m.To()
|
||||
if _, ok := m.(*message.PrivateMsg); ok {
|
||||
fromMsg, _ := m.(message.MessageFrom)
|
||||
if fromMsg != nil && user.Ignored.In(fromMsg.From().ID()) {
|
||||
// Skip because ignored
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
user.Send(m)
|
||||
default:
|
||||
fromMsg, _ := m.(message.MessageFrom)
|
||||
|
@ -107,6 +107,7 @@ func TestIgnore(t *testing.T) {
|
||||
|
||||
// when an emote is sent by an ignored user, it should not be displayed
|
||||
ch.Send(message.NewEmoteMsg("crying", ignored.user))
|
||||
|
||||
if ignorer.user.HasMessages() {
|
||||
t.Fatal("should not have emote messages")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user