mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-31 10:43: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()
|
defer n.streamLock.Unlock()
|
||||||
|
|
||||||
var wakeUserIDs []string
|
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 {
|
for _, users := range n.roomIDToJoinedUsers {
|
||||||
// user sending presence is not in room
|
// user sending presence is not in room
|
||||||
if !users[userID] {
|
if !users[userID] {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// check all users in room
|
|
||||||
for user := range users {
|
wakeUserIDs = append(wakeUserIDs, users.values()...)
|
||||||
_, domain, err := gomatrixserverlib.SplitID('@', user)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if domain == wantDomain {
|
|
||||||
wakeUserIDs = append(wakeUserIDs, user)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
n.currPos.ApplyUpdates(posUpdate)
|
n.currPos.ApplyUpdates(posUpdate)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue