(fromUid types.Uid, now time.Time)
| 85 | } |
| 86 | |
| 87 | func (t *Topic) preparePushForSubReceipt(fromUid types.Uid, now time.Time) *push.Receipt { |
| 88 | // The `Topic` in the push receipt is `t.xoriginal` for group topics, `fromUid` for p2p topics, |
| 89 | // not the t.original(fromUid) because it's the topic name as seen by the recipient, not by the sender. |
| 90 | topic := t.xoriginal |
| 91 | if t.cat == types.TopicCatP2P { |
| 92 | topic = fromUid.UserId() |
| 93 | } |
| 94 | |
| 95 | // Initialize the push receipt. |
| 96 | receipt := &push.Receipt{ |
| 97 | To: make(map[types.Uid]push.Recipient, t.subsCount()), |
| 98 | Payload: push.Payload{ |
| 99 | What: push.ActSub, |
| 100 | Silent: false, |
| 101 | Topic: topic, |
| 102 | From: fromUid.UserId(), |
| 103 | Timestamp: now, |
| 104 | SeqId: t.lastID, |
| 105 | }, |
| 106 | } |
| 107 | return receipt |
| 108 | } |
| 109 | |
| 110 | // Prepares payload to be delivered to a mobile device as a push notification in response to a new subscription in a p2p topic. |
| 111 | func (t *Topic) pushForP2PSub(fromUid, toUid types.Uid, want, given types.AccessMode, now time.Time) *push.Receipt { |
no test coverage detected