Don't read NotifySpecified in push rules
This commit is contained in:
parent
2751b186fa
commit
099006c9c3
@ -687,10 +687,9 @@ func (c *Container) HandleMessage(source mautrix.EventSource, mxEvent *event.Eve
|
|||||||
|
|
||||||
if !room.Loaded() {
|
if !room.Loaded() {
|
||||||
pushRules := c.PushRules().GetActions(room, evt.Event).Should()
|
pushRules := c.PushRules().GetActions(room, evt.Event).Should()
|
||||||
shouldNotify := pushRules.Notify || !pushRules.NotifySpecified
|
if !pushRules.Notify {
|
||||||
if !shouldNotify {
|
|
||||||
room.LastReceivedMessage = time.Unix(evt.Timestamp/1000, evt.Timestamp%1000*1000)
|
room.LastReceivedMessage = time.Unix(evt.Timestamp/1000, evt.Timestamp%1000*1000)
|
||||||
room.AddUnread(evt.ID, shouldNotify, pushRules.Highlight)
|
room.AddUnread(evt.ID, pushRules.Notify, pushRules.Highlight)
|
||||||
mainView.Bump(room)
|
mainView.Bump(room)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -411,17 +411,14 @@ func (view *MainView) NotifyMessage(room *rooms.Room, message ifc.Message, shoul
|
|||||||
recentlyFocused := time.Now().Add(-30 * time.Second).Before(view.lastFocusTime)
|
recentlyFocused := time.Now().Add(-30 * time.Second).Before(view.lastFocusTime)
|
||||||
isFocused := time.Now().Add(-5 * time.Second).Before(view.lastFocusTime)
|
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
|
|
||||||
|
|
||||||
if !isCurrent || !isFocused {
|
if !isCurrent || !isFocused {
|
||||||
// The message is not in the current room, show new message status in room list.
|
// The message is not in the current room, show new message status in room list.
|
||||||
room.AddUnread(message.ID(), shouldNotify, should.Highlight)
|
room.AddUnread(message.ID(), should.Notify, should.Highlight)
|
||||||
} else {
|
} else {
|
||||||
view.matrix.MarkRead(room.ID, message.ID())
|
view.matrix.MarkRead(room.ID, message.ID())
|
||||||
}
|
}
|
||||||
|
|
||||||
if shouldNotify && !recentlyFocused && !view.config.Preferences.DisableNotifications {
|
if should.Notify && !recentlyFocused && !view.config.Preferences.DisableNotifications {
|
||||||
// Push rules say notify and the terminal is not focused, send desktop notification.
|
// Push rules say notify and the terminal is not focused, send desktop notification.
|
||||||
shouldPlaySound := should.PlaySound &&
|
shouldPlaySound := should.PlaySound &&
|
||||||
should.SoundName == "default" &&
|
should.SoundName == "default" &&
|
||||||
|
Loading…
Reference in New Issue
Block a user