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 /me
emote
This commit is contained in:
parent
403bb5911b
commit
7169ee1240
@ -138,9 +138,7 @@ func (m PublicMsg) String() string {
|
||||
return fmt.Sprintf("%s: %s", m.from.Name(), m.body)
|
||||
}
|
||||
|
||||
// EmoteMsg is a /me message sent to the room. It specifically does not
|
||||
// extend PublicMsg because it doesn't implement MessageFrom to allow the
|
||||
// sender to see the emote.
|
||||
// EmoteMsg is a /me message sent to the room.
|
||||
type EmoteMsg struct {
|
||||
Msg
|
||||
from *User
|
||||
@ -156,6 +154,10 @@ func NewEmoteMsg(body string, from *User) *EmoteMsg {
|
||||
}
|
||||
}
|
||||
|
||||
func (m EmoteMsg) From() *User {
|
||||
return m.from
|
||||
}
|
||||
|
||||
func (m EmoteMsg) Render(t *Theme) string {
|
||||
return fmt.Sprintf("** %s %s", m.from.Name(), m.body)
|
||||
}
|
||||
|
@ -105,6 +105,12 @@ func TestIgnore(t *testing.T) {
|
||||
t.Fatalf("should have %d ignored users, has %d", 1, len(ignoredList))
|
||||
}
|
||||
|
||||
// ignoring the same user twice returns an error message and doesn't add the user twice
|
||||
ch.Send(message.NewEmoteMsg("crying", ignored.user))
|
||||
if ignorer.user.HasMessages() {
|
||||
t.Fatal("should not have emote messages")
|
||||
}
|
||||
|
||||
// when a message is sent from the ignored user, it is delivered to non-ignoring users
|
||||
ch.Send(message.NewPublicMsg("hello", ignored.user))
|
||||
other.user.HandleMsg(other.user.ConsumeOne())
|
||||
|
Loading…
x
Reference in New Issue
Block a user