fix p2p topic canonicalization and stale subscriptions

This commit is contained in:
richjohnrambo
2026-09-12 00:08:30 +08:00
parent f1dfffcfb5
commit a9a4970d9f
9 changed files with 148 additions and 66 deletions
+2 -10
View File
@@ -143,18 +143,10 @@ func PrepareV1Notifications(rcpt *push.Receipt, config *configType) ([]*fcmv1.Me
for uid, devList := range devices {
topic := rcpt.Payload.Topic
userData := data
tcat := t.GetTopicCat(topic)
if rcpt.To[uid].Delivered > 0 || tcat == t.TopicCatP2P {
if rcpt.To[uid].Delivered > 0 {
userData = clonePayload(data)
// Fix topic name for P2P pushes.
if tcat == t.TopicCatP2P {
topic, _ = t.P2PNameForUser(uid, topic)
userData["topic"] = topic
}
// Silence the push for user who have received the data interactively.
if rcpt.To[uid].Delivered > 0 {
userData["silent"] = "true"
}
userData["silent"] = "true"
}
for i := range devList {