Page MenuHomePhabricator

Send visual notifications in the same order as they were encrypted
ClosedPublic

Authored by marcin on Nov 10 2023, 6:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 26, 8:26 PM
Unknown Object (File)
Thu, Dec 26, 7:03 PM
Unknown Object (File)
Thu, Dec 26, 7:03 PM
Unknown Object (File)
Thu, Dec 26, 7:03 PM
Unknown Object (File)
Thu, Dec 26, 7:03 PM
Unknown Object (File)
Wed, Dec 25, 10:13 PM
Unknown Object (File)
Mon, Dec 16, 6:36 AM
Unknown Object (File)
Mon, Dec 16, 6:36 AM
Subscribers

Details

Summary

This differential ensure that visual (the ones making an alert) notifications are sent in the same order as they were encrypted with respect to the same
device withing single sendPushNotifs promise resolution. This is achieved by separating notification preparation and notification delivery steps. First
notifications are prepared (constructed and encrypted). This
step is entirely asynchronous. Then encrypted notifications are groupped by device token. In the same group notifications are sent sequentially in order mthcing
encryption order. Different groups are awaited asynchronously.

Test Plan
  1. Test that notifications functionality remains unchanged - I sent messages and rescinds between four devices: two webs and two natives (Android and iOS).
  2. Test that notifications are indeed sent in encryption order for single device - I added console.log to each <platform>Push function to examine whether notifications are sent in the right order based on encryptionOrder field of Targeted<platform>Notification instance.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Rebase to update commit message

Fix bug: Add encryptionOrder field from the value returned from prepareEncrypted<IOS/Android>Notifications to the value returned from
prepare<APNs/Android>Notification.

keyserver/src/push/send.js
159 ↗(On Diff #33070)

Can you separate this out so the await is its own assignment?

494 ↗(On Diff #33070)

Can you separate this out so the .flat() happens on its own line?

ashoat added inline comments.
keyserver/src/push/send.js
459–473 ↗(On Diff #33070)

Can these two maps be combined into one?

502–505 ↗(On Diff #33070)

I think this is supposed to be two function invocations in lodash/fp, no?

507–516 ↗(On Diff #33070)

Does this function need to be redefined every time deliverPushNotifsInEncryptionOrder is invoked?

529 ↗(On Diff #33070)

Please pull await to the top level, you are hiding it here. await should either be the first word in the statement, or the first part of the right side of an assignment

554 ↗(On Diff #33070)

Please pull the flat to its own line

This revision is now accepted and ready to land.Nov 11 2023, 4:01 PM
  1. Address JS code quality issues.
  2. Improve typing of arrays.