Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide disabled actions from main secondary interaction (right click/long tap) report action context menu for System chats #44808

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -889,12 +892,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
Loading