From 512ca88804268bf58a754e8a02be556f953db317 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 16 May 2018 21:42:07 +0300 Subject: Fix notifications about own messages --- ui/view-main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ui/view-main.go') diff --git a/ui/view-main.go b/ui/view-main.go index 9f7c690..c8977d3 100644 --- a/ui/view-main.go +++ b/ui/view-main.go @@ -429,6 +429,10 @@ func sendNotification(room *rooms.Room, sender, text string, critical, sound boo } func (view *MainView) NotifyMessage(room *rooms.Room, message ifc.Message, should pushrules.PushActionArrayShould) { + view.roomList.Bump(room) + if message.SenderID() == view.config.Session.UserID { + return + } // Whether or not the room where the message came is the currently shown room. isCurrent := room == view.roomList.SelectedRoom() // Whether or not the terminal window is focused. @@ -436,7 +440,7 @@ func (view *MainView) NotifyMessage(room *rooms.Room, message ifc.Message, shoul isFocused := time.Now().Add(-5 * time.Second).Before(view.lastFocusTime) // Whether or not the push rules say this message should be notified about. - shouldNotify := (should.Notify || !should.NotifySpecified) && message.Sender() != view.config.Session.UserID + shouldNotify := should.Notify || !should.NotifySpecified if !isCurrent || !isFocused { // The message is not in the current room, show new message status in room list. @@ -452,7 +456,6 @@ func (view *MainView) NotifyMessage(room *rooms.Room, message ifc.Message, shoul } message.SetIsHighlight(should.Highlight) - view.roomList.Bump(room) } func (view *MainView) InitialSyncDone() { -- cgit v1.2.3