From 63e476eeefa8e4a45892327cfe2b9bf03d0c4dfc Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Wed, 28 Aug 2024 20:07:02 +0300 Subject: [PATCH 1/2] avoid adding admin label for workspace chat reports --- src/libs/ReportUtils.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index a000d64a9adf..1ed92606b712 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4975,6 +4975,10 @@ function buildOptimisticTaskReportAction( }; } +function isWorkspaceChat(chatType: string) { + return chatType === CONST.REPORT.CHAT_TYPE.POLICY_ADMINS || chatType === CONST.REPORT.CHAT_TYPE.POLICY_ANNOUNCE || chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT; +} + /** * Builds an optimistic chat report with a randomly generated reportID and as much information as we currently have */ @@ -4996,10 +5000,11 @@ function buildOptimisticChatReport( optimisticReportID = '', shouldShowParticipants = true, ): OptimisticChatReport { + const isWorkspaceChatType = chatType && isWorkspaceChat(chatType); const participants = participantList.reduce((reportParticipants: Participants, accountID: number) => { const participant: ReportParticipant = { hidden: !shouldShowParticipants, - role: accountID === currentUserAccountID ? CONST.REPORT.ROLE.ADMIN : CONST.REPORT.ROLE.MEMBER, + ...(!isWorkspaceChatType && {role: accountID === currentUserAccountID ? CONST.REPORT.ROLE.ADMIN : CONST.REPORT.ROLE.MEMBER}), }; // eslint-disable-next-line no-param-reassign reportParticipants[accountID] = participant; From 66ab027052d26f57218dcdd422db303756ab147d Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Thu, 29 Aug 2024 00:38:47 +0300 Subject: [PATCH 2/2] fix test --- tests/actions/PolicyTest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/actions/PolicyTest.ts b/tests/actions/PolicyTest.ts index 5b95d50eed52..a9af7b9da7d8 100644 --- a/tests/actions/PolicyTest.ts +++ b/tests/actions/PolicyTest.ts @@ -12,7 +12,7 @@ import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; const ESH_EMAIL = 'eshgupta1217@gmail.com'; const ESH_ACCOUNT_ID = 1; -const ESH_PARTICIPANT: Participant = {hidden: false, role: 'admin'}; +const ESH_PARTICIPANT: Participant = {hidden: false}; const WORKSPACE_NAME = "Esh's Workspace"; OnyxUpdateManager();