fix p2p topic canonicalization and stale subscriptions
This commit is contained in:
+6
-6
@@ -87,11 +87,11 @@ func (t *Topic) pushForData(fromUid types.Uid, data *MsgServerData, msgMarkedAsR
|
||||
}
|
||||
|
||||
func (t *Topic) preparePushForSubReceipt(fromUid types.Uid, now time.Time) *push.Receipt {
|
||||
// The `Topic` in the push receipt is `t.xoriginal` for group topics, `fromUid` for p2p topics,
|
||||
// not the t.original(fromUid) because it's the topic name as seen by the recipient, not by the sender.
|
||||
// P2P push payloads use the canonical p2p... topic. usr... is accepted only
|
||||
// as an input alias.
|
||||
topic := t.xoriginal
|
||||
if t.cat == types.TopicCatP2P {
|
||||
topic = fromUid.UserId()
|
||||
topic = t.name
|
||||
}
|
||||
|
||||
// Initialize the push receipt.
|
||||
@@ -165,11 +165,11 @@ func pushForChanDelete(tenantID types.TenantID, topicName string, now time.Time)
|
||||
|
||||
// Prepares payload to be delivered to a mobile device as a push notification in response to receiving "read" notification.
|
||||
func (t *Topic) pushForReadRcpt(uid types.Uid, seq int64, now time.Time) *push.Receipt {
|
||||
// The `Topic` in the push receipt is `t.xoriginal` for group topics, `fromUid` for p2p topics,
|
||||
// not the t.original(fromUid) because it's the topic name as seen by the recipient, not by the sender.
|
||||
// P2P push payloads use the canonical p2p... topic. usr... is accepted only
|
||||
// as an input alias.
|
||||
topic := t.xoriginal
|
||||
if t.cat == types.TopicCatP2P {
|
||||
topic = uid.UserId()
|
||||
topic = t.name
|
||||
}
|
||||
|
||||
// Initialize the push receipt.
|
||||
|
||||
Reference in New Issue
Block a user