Skip to content

Commit

Permalink
[lib] update creatorID -> unread in CreateThickRawThreadInfoInput
Browse files Browse the repository at this point in the history
Summary:
[ENG-8568](https://linear.app/comm/issue/ENG-8568/logic-for-adding-a-user-user-joining-a-thick-thread)

We need to use `CreateThickRawThreadInfoInput` when creating `ADD_VIEWER_TO_THREAD_MEMBERS`, where it's complicated to retrieve `creatorID`.

`creatorID` is used only for computing `unread`, that being said we can simplify this.

Test Plan: Flow

Reviewers: tomek, inka

Reviewed By: tomek

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D13181
  • Loading branch information
xsanm committed Aug 28, 2024
1 parent 4859f1e commit 0979775
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/shared/dm-ops/create-sidebar-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const createSidebarSpec: DMOperationSpec<DMCreateSidebarOperation> =
parentThreadID,
allMemberIDs,
roleID,
creatorID,
unread: creatorID !== viewerID,
sourceMessageID,
containingThreadID: parentThreadID,
},
Expand Down
6 changes: 3 additions & 3 deletions lib/shared/dm-ops/create-thread-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function createThickRawThreadInfo(
parentThreadID,
allMemberIDs,
roleID,
creatorID,
unread,
name,
avatar,
description,
Expand Down Expand Up @@ -107,7 +107,7 @@ function createThickRawThreadInfo(
role: role.id,
permissions: membershipPermissions,
subscription: joinThreadSubscription,
unread: creatorID !== viewerID,
unread,
}),
repliesCount: repliesCount ?? 0,
name,
Expand Down Expand Up @@ -171,7 +171,7 @@ const createThreadSpec: DMOperationSpec<DMCreateThreadOperation> =
creationTime: time,
allMemberIDs,
roleID,
creatorID,
unread: creatorID !== viewerID,
},
viewerID,
);
Expand Down
4 changes: 2 additions & 2 deletions lib/types/dm-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export type CreateThickRawThreadInfoInput = {
+parentThreadID?: ?string,
+allMemberIDs: $ReadOnlyArray<string>,
+roleID: string,
+creatorID: string,
+unread: boolean,
+name?: ?string,
+avatar?: ?ClientAvatar,
+description?: ?string,
Expand All @@ -58,7 +58,7 @@ export const createThickRawThreadInfoInputValidator: TInterface<CreateThickRawTh
parentThreadID: t.maybe(t.String),
allMemberIDs: t.list(tUserID),
roleID: t.String,
creatorID: tUserID,
unread: t.Boolean,
name: t.maybe(t.String),
avatar: t.maybe(clientAvatarValidator),
description: t.maybe(t.String),
Expand Down

0 comments on commit 0979775

Please sign in to comment.