Skip to content

Commit

Permalink
Merge pull request #44808 from c3024/hide-disabled-actions-from-main-…
Browse files Browse the repository at this point in the history
…report-action-context-menu

Hide disabled actions from main secondary interaction (right click/long tap) report action context menu for System chats
  • Loading branch information
marcaaron committed Jul 5, 2024
2 parents 3a2de49 + 4b015f3 commit 80b0849
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ function ReportActionItem({
setIsContextMenuActive(ReportActionContextMenu.isActiveReportAction(action.reportActionID));
}, [action.reportActionID]);

const isArchivedRoom = ReportUtils.isArchivedRoomWithID(originalReportID);
const disabledActions = useMemo(() => (!ReportUtils.canWriteInReport(report) ? RestrictedReadOnlyContextMenuActions : []), [report]);
const isChronosReport = ReportUtils.chatIncludesChronosWithID(originalReportID);
/**
* Show the ReportActionContextMenu modal popover.
*
Expand All @@ -350,16 +353,16 @@ function ReportActionItem({
draftMessage ?? '',
() => setIsContextMenuActive(true),
toggleContextMenuFromActiveReportAction,
ReportUtils.isArchivedRoomWithID(originalReportID),
ReportUtils.chatIncludesChronosWithID(originalReportID),
isArchivedRoom,
isChronosReport,
false,
false,
[],
disabledActions,
false,
setIsEmojiPickerActive as () => void,
);
},
[draftMessage, action, report.reportID, toggleContextMenuFromActiveReportAction, originalReportID, shouldDisplayContextMenu],
[draftMessage, action, report.reportID, toggleContextMenuFromActiveReportAction, originalReportID, shouldDisplayContextMenu, disabledActions, isArchivedRoom, isChronosReport],
);

// Handles manual scrolling to the bottom of the chat when the last message is an actionable whisper and it's resolved.
Expand Down Expand Up @@ -891,12 +894,12 @@ function ReportActionItem({
reportActionID={action.reportActionID}
anchor={popoverAnchorRef}
originalReportID={originalReportID ?? '-1'}
isArchivedRoom={ReportUtils.isArchivedRoom(report)}
isArchivedRoom={isArchivedRoom}
displayAsGroup={displayAsGroup}
disabledActions={!ReportUtils.canWriteInReport(report) ? RestrictedReadOnlyContextMenuActions : []}
disabledActions={disabledActions}
isVisible={hovered && draftMessage === undefined && !hasErrors}
draftMessage={draftMessage}
isChronosReport={ReportUtils.chatIncludesChronosWithID(originalReportID)}
isChronosReport={isChronosReport}
checkIfContextMenuActive={toggleContextMenuFromActiveReportAction}
setIsEmojiPickerActive={setIsEmojiPickerActive}
/>
Expand Down

0 comments on commit 80b0849

Please sign in to comment.