Skip to content

Commit

Permalink
send silent pushes to the message sender too (no pushes were sent bef…
Browse files Browse the repository at this point in the history
…ore)
  • Loading branch information
or-else committed Jul 19, 2021
1 parent 5a424f3 commit b74e765
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions server/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3203,16 +3203,19 @@ func (t *Topic) pushForData(fromUid types.Uid, data *MsgServerData) *push.Receip
}

for uid, pud := range t.perUser {
// Send only to those who have notifications enabled, exclude the originating user.
if uid == fromUid {
continue
online := pud.online
if uid == fromUid && online == 0 {
// Make sure the sender's devices receive a silent push.
online = 1
}

// Send only to those who have notifications enabled.
mode := pud.modeWant & pud.modeGiven
if mode.IsPresencer() && mode.IsReader() && !pud.deleted && !pud.isChan {
receipt.To[uid] = push.Recipient{
// Number of sessions this data message will be delivered to.
// Number of attached sessions the data message will be delivered to.
// Push notifications sent to users with non-zero online sessions will be marked silent.
Delivered: pud.online,
Delivered: online,
}
}
}
Expand Down

0 comments on commit b74e765

Please sign in to comment.