Skip to content

Commit

Permalink
[keyserver] Stop sending incorrect macOS rescinds
Browse files Browse the repository at this point in the history
Summary:
[ENG-4523](https://linear.app/comm/issue/ENG-4523/stop-sending-incorrect-macos-rescinds)

Because of handling of older deliveries with only `iosID`, and because we were always setting parsedDeliveries' platform to `'ios'` we were incorrectly trying to send rescinds for macOS notifications. This diff makes it so we are setting the platform correctly, and the parsed deliveries for macos are filtered later in the code.

Test Plan: - Check that after displaying a notification no rescinds for macOS are sent

Reviewers: kamil, tomek, marcin, ashoat

Reviewed By: ashoat

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D8699
  • Loading branch information
MichalGniadek committed Aug 2, 2023
1 parent dda2db8 commit 7df7998
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions keyserver/src/push/rescind.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ async function rescindPushNotifs(
const rowParsedDeliveries = [];

for (const delivery of deliveries) {
if (delivery.iosID || delivery.deviceType === 'ios') {
if (
delivery.iosID ||
delivery.deviceType === 'ios' ||
delivery.deviceType === 'macos'
) {
const deviceTokens = delivery.iosDeviceTokens ?? delivery.deviceTokens;
rowParsedDeliveries.push({
notificationID: delivery.iosID,
codeVersion: delivery.codeVersion,
platform: 'ios',
platform: delivery.deviceType ?? 'ios',
deviceTokens,
});
deviceTokens.forEach(deviceToken => allDeviceTokens.add(deviceToken));
Expand Down

0 comments on commit 7df7998

Please sign in to comment.