Skip to content

Commit 8f717f2

Browse files
committed
fix: make same changes for policy invite/remove action
1 parent d33cd39 commit 8f717f2

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

src/libs/OptionsListUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import {
8989
isCreatedTaskReportAction,
9090
isDeletedAction,
9191
isDeletedParentAction,
92+
isInviteOrRemovedAction,
9293
isMarkAsClosedAction,
9394
isModifiedExpenseAction,
9495
isMoneyRequestAction,
@@ -99,7 +100,6 @@ import {
99100
isReimbursementQueuedAction,
100101
isRenamedAction,
101102
isReportPreviewAction,
102-
isRoomChangeLogAction,
103103
isTaskAction,
104104
isThreadParentMessage,
105105
isUnapprovedAction,
@@ -831,7 +831,7 @@ function getLastMessageTextForReport(report: OnyxEntry<Report>, lastActorDetails
831831
lastMessageTextFromReport = getPolicyChangeMessage(lastReportAction);
832832
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.TRAVEL_UPDATE)) {
833833
lastMessageTextFromReport = getTravelUpdateMessage(lastReportAction);
834-
} else if (isRoomChangeLogAction(lastReportAction)) {
834+
} else if (isInviteOrRemovedAction(lastReportAction)) {
835835
lastMessageTextFromReport = getRoomChangeLogMessage(lastReportAction);
836836
} else if (isRenamedAction(lastReportAction)) {
837837
lastMessageTextFromReport = getRenamedAction(lastReportAction, isExpenseReport(report));

src/libs/ReportActionsUtils.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2885,17 +2885,15 @@ function getCardIssuedMessage({
28852885
}
28862886

28872887
function getRoomChangeLogMessage(reportAction: ReportAction) {
2888-
if (
2889-
!isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.INVITE_TO_ROOM) &&
2890-
!isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.REMOVE_FROM_ROOM)
2891-
) {
2888+
if (!isInviteOrRemovedAction(reportAction)) {
28922889
return '';
28932890
}
28942891
const originalMessage = getOriginalMessage(reportAction);
28952892
const targetAccountIDs: number[] = originalMessage?.targetAccountIDs ?? [];
2896-
const actionText = isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.INVITE_TO_ROOM)
2897-
? translateLocal('workspace.invite.invited')
2898-
: translateLocal('workspace.invite.removed');
2893+
const actionText =
2894+
isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.INVITE_TO_ROOM) || isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.INVITE_TO_ROOM)
2895+
? translateLocal('workspace.invite.invited')
2896+
: translateLocal('workspace.invite.removed');
28992897
const userText = (targetAccountIDs.length === 1 ? translateLocal('common.member') : translateLocal('common.members')).toLowerCase();
29002898
return `${actionText} ${targetAccountIDs.length} ${userText}`;
29012899
}

0 commit comments

Comments
 (0)