aboutsummaryrefslogtreecommitdiff
path: root/matrix
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2019-06-15 17:51:36 +0300
committerTulir Asokan <tulir@maunium.net>2019-06-15 17:51:36 +0300
commit0f08c49df40f77e90e4b5ef7604c74631065faa3 (patch)
treefaaf36bfa7dd891b50bb7fcb01ff738353a034d2 /matrix
parent160b035c4d5b88516cb4d1f4e26ec2e2e0262bcc (diff)
Fix bumping unloaded rooms in room list when receiving messages
Diffstat (limited to 'matrix')
-rw-r--r--matrix/matrix.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go
index 8c19b24..1a75f96 100644
--- a/matrix/matrix.go
+++ b/matrix/matrix.go
@@ -315,7 +315,7 @@ func (c *Container) HandleMessage(source EventSource, evt *mautrix.Event) {
debug.Printf("Failed to add event %s to history: %v", evt.ID, err)
}
- if !c.config.AuthCache.InitialSyncDone || !room.Loaded() {
+ if !c.config.AuthCache.InitialSyncDone {
room.LastReceivedMessage = time.Unix(evt.Timestamp/1000, evt.Timestamp%1000*1000)
return
}
@@ -328,6 +328,17 @@ func (c *Container) HandleMessage(source EventSource, evt *mautrix.Event) {
return
}
+ if !room.Loaded() {
+ pushRules := c.PushRules().GetActions(room, evt).Should()
+ shouldNotify := pushRules.Notify || !pushRules.NotifySpecified
+ if !shouldNotify {
+ room.LastReceivedMessage = time.Unix(evt.Timestamp/1000, evt.Timestamp%1000*1000)
+ room.AddUnread(evt.ID, shouldNotify, pushRules.Highlight)
+ mainView.Bump(room)
+ return
+ }
+ }
+
// TODO switch to roomView.AddEvent
message := roomView.ParseEvent(evt)
if message != nil {