Skip to content

Commit

Permalink
Fix input types from D13050
Browse files Browse the repository at this point in the history
Summary: This differential fixes types according to Ashoat suggestion: https://phab.comm.dev/D13050#inline-76348

Test Plan: flow

Reviewers: ashoat

Reviewed By: ashoat

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D13271
  • Loading branch information
marcinwasowicz committed Sep 11, 2024
1 parent 5e6ea06 commit 0e2412f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
4 changes: 3 additions & 1 deletion keyserver/src/push/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,9 @@ async function fetchInfos(pushInfo: PushInfo) {

async function fetchNotifUserInfos(
serverThreadInfos: { +[threadID: string]: ServerThreadInfo },
usersToCollapsableNotifInfo: { +[userID: string]: CollapsableNotifInfo[] },
usersToCollapsableNotifInfo: {
+[userID: string]: $ReadOnlyArray<CollapsableNotifInfo>,
},
) {
const missingUserIDs = new Set<string>();

Expand Down
26 changes: 19 additions & 7 deletions lib/push/send-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export type CollapsableNotifInfo = {
};

export type FetchCollapsableNotifsResult = {
[userID: string]: CollapsableNotifInfo[],
+[userID: string]: $ReadOnlyArray<CollapsableNotifInfo>,
};

function identityPlatformDetailsToPlatformDetails(
Expand Down Expand Up @@ -302,9 +302,11 @@ function getOwnDevicesPushInfo(

function pushInfoToCollapsableNotifInfo(pushInfo: PushInfo): {
+usersToCollapseKeysToInfo: {
[string]: { [string]: CollapsableNotifInfo },
+[string]: { +[string]: CollapsableNotifInfo },
},
+usersToCollapsableNotifInfo: {
+[string]: $ReadOnlyArray<CollapsableNotifInfo>,
},
+usersToCollapsableNotifInfo: { [string]: Array<CollapsableNotifInfo> },
} {
const usersToCollapseKeysToInfo: {
[string]: { [string]: CollapsableNotifInfo },
Expand Down Expand Up @@ -348,13 +350,23 @@ function pushInfoToCollapsableNotifInfo(pushInfo: PushInfo): {

function mergeUserToCollapsableInfo(
usersToCollapseKeysToInfo: {
[string]: { [string]: CollapsableNotifInfo },
+[string]: { +[string]: CollapsableNotifInfo },
},
usersToCollapsableNotifInfo: {
+[string]: $ReadOnlyArray<CollapsableNotifInfo>,
},
usersToCollapsableNotifInfo: { [string]: Array<CollapsableNotifInfo> },
): { [string]: Array<CollapsableNotifInfo> } {
const mergedUsersToCollapsableInfo = { ...usersToCollapsableNotifInfo };
): { +[string]: $ReadOnlyArray<CollapsableNotifInfo> } {
const mergedUsersToCollapsableInfo: {
[string]: Array<CollapsableNotifInfo>,
} = {};

for (const userID in usersToCollapseKeysToInfo) {
const collapseKeysToInfo = usersToCollapseKeysToInfo[userID];

mergedUsersToCollapsableInfo[userID] = [
...usersToCollapsableNotifInfo[userID],
];

for (const collapseKey in collapseKeysToInfo) {
const info = collapseKeysToInfo[collapseKey];
mergedUsersToCollapsableInfo[userID].push({
Expand Down

0 comments on commit 0e2412f

Please sign in to comment.