mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 01:33:10 -06:00
Let wakeupUsers handle which users to wake
This commit is contained in:
parent
2e6eb4e0a9
commit
a3039af449
|
|
@ -224,26 +224,13 @@ func (n *Notifier) OnNewPresence(
|
|||
defer n.streamLock.Unlock()
|
||||
|
||||
var wakeUserIDs []string
|
||||
_, wantDomain, err := gomatrixserverlib.SplitID('@', userID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// determine if users share a room and needs to be woken up
|
||||
for _, users := range n.roomIDToJoinedUsers {
|
||||
// user sending presence is not in room
|
||||
if !users[userID] {
|
||||
continue
|
||||
}
|
||||
// check all users in room
|
||||
for user := range users {
|
||||
_, domain, err := gomatrixserverlib.SplitID('@', user)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if domain == wantDomain {
|
||||
wakeUserIDs = append(wakeUserIDs, user)
|
||||
}
|
||||
}
|
||||
|
||||
wakeUserIDs = append(wakeUserIDs, users.values()...)
|
||||
}
|
||||
|
||||
n.currPos.ApplyUpdates(posUpdate)
|
||||
|
|
|
|||
Loading…
Reference in a new issue