Skip to content

Commit

Permalink
Merge pull request #20737 from dukenv0307/fix/20306
Browse files Browse the repository at this point in the history
Hidden reveal message button when editing message
  • Loading branch information
robertjchen authored Jun 14, 2023
2 parents 0a471b0 + 3b46dd7 commit 23978e4
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function ReportActionItem(props) {

// Hide the message if it is being moderated for a higher offense, or is hidden by a moderator
// Removed messages should not be shown anyway and should not need this flow

useEffect(() => {
if (!props.action.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT || _.isEmpty(props.action.message[0].moderationDecisions)) {
return;
Expand All @@ -146,7 +147,10 @@ function ReportActionItem(props) {
setIsHidden(true);
}
setModerationDecision(latestDecision.decision);
}, [props.action.message, props.action.actionName]);

// props.action.message doesn't need to be a dependency, we only need to check the change of props.action.message[0].moderationDecisions
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.action.message[0].moderationDecisions, props.action.actionName]);

const toggleContextMenuFromActiveReportAction = useCallback(() => {
setIsContextMenuActive(ReportActionContextMenu.isActiveReportAction(props.action.reportActionID));
Expand Down Expand Up @@ -279,7 +283,7 @@ function ReportActionItem(props) {
: undefined,
]}
/>
{props.displayAsGroup && hasBeenFlagged && (
{hasBeenFlagged && (
<Button
small
style={[styles.mt2, styles.alignSelfStart]}
Expand Down Expand Up @@ -309,20 +313,6 @@ function ReportActionItem(props) {
}
/>
)}
{!props.displayAsGroup && hasBeenFlagged && (
<Button
small
style={[styles.mt2, styles.alignSelfStart]}
onPress={() => setIsHidden(!isHidden)}
>
<Text
style={styles.buttonSmallText}
selectable={false}
>
{isHidden ? props.translate('moderation.revealMessage') : props.translate('moderation.hideMessage')}
</Text>
</Button>
)}
</ShowContextMenuContext.Provider>
);
}
Expand Down

0 comments on commit 23978e4

Please sign in to comment.