Skip to content

Commit

Permalink
[lib] implement reply count for composable DM messages
Browse files Browse the repository at this point in the history
Summary:
[ENG-9273](https://linear.app/comm/issue/ENG-9273/update-the-reply-count-for-thick-sidebars).

Depends on D13426

Test Plan:
1. Reply count on sender.
2. Reply count on receiver.
3. Reply count when retrying.
Tested both web and native.

Reviewers: tomek, marcin

Reviewed By: tomek

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D13427
  • Loading branch information
xsanm committed Sep 23, 2024
1 parent 0a5c4d4 commit 887af93
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions lib/shared/dm-ops/process-dm-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,34 @@ function useSendComposableDMOperation(): (
utilities,
);

const notificationsCreationData = await dmOpSpecs[
op.type
].notificationsCreationData?.(op, utilities);
const spec = dmOpSpecs[op.type];

const notificationsCreationDataPromise: Promise<?NotificationsCreationData> =
(async () => {
if (!spec?.notificationsCreationData) {
return null;
}
return await spec.notificationsCreationData(op, utilities);
})();

const [{ rawMessageInfos, updateInfos }, notificationsCreationData] =
await Promise.all([
dmOpSpecs[op.type].processDMOperation(op, utilities),
notificationsCreationDataPromise,
]);

const newUpdateInfos = getThreadUpdatesForNewMessages(
rawMessageInfos,
updateInfos,
utilities,
);

dispatchWithMetadata(
{
type: processDMOpsActionType,
payload: {
rawMessageInfos: [],
updateInfos: [],
updateInfos: newUpdateInfos,
outboundP2PMessages,
composableMessageID,
notificationsCreationData,
Expand Down

0 comments on commit 887af93

Please sign in to comment.