Skip to content

Commit 23978e4

Browse files
authored
Merge pull request #20737 from dukenv0307/fix/20306
Hidden reveal message button when editing message
2 parents 0a471b0 + 3b46dd7 commit 23978e4

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/pages/home/report/ReportActionItem.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ function ReportActionItem(props) {
131131

132132
// Hide the message if it is being moderated for a higher offense, or is hidden by a moderator
133133
// Removed messages should not be shown anyway and should not need this flow
134+
134135
useEffect(() => {
135136
if (!props.action.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT || _.isEmpty(props.action.message[0].moderationDecisions)) {
136137
return;
@@ -146,7 +147,10 @@ function ReportActionItem(props) {
146147
setIsHidden(true);
147148
}
148149
setModerationDecision(latestDecision.decision);
149-
}, [props.action.message, props.action.actionName]);
150+
151+
// props.action.message doesn't need to be a dependency, we only need to check the change of props.action.message[0].moderationDecisions
152+
// eslint-disable-next-line react-hooks/exhaustive-deps
153+
}, [props.action.message[0].moderationDecisions, props.action.actionName]);
150154

151155
const toggleContextMenuFromActiveReportAction = useCallback(() => {
152156
setIsContextMenuActive(ReportActionContextMenu.isActiveReportAction(props.action.reportActionID));
@@ -279,7 +283,7 @@ function ReportActionItem(props) {
279283
: undefined,
280284
]}
281285
/>
282-
{props.displayAsGroup && hasBeenFlagged && (
286+
{hasBeenFlagged && (
283287
<Button
284288
small
285289
style={[styles.mt2, styles.alignSelfStart]}
@@ -309,20 +313,6 @@ function ReportActionItem(props) {
309313
}
310314
/>
311315
)}
312-
{!props.displayAsGroup && hasBeenFlagged && (
313-
<Button
314-
small
315-
style={[styles.mt2, styles.alignSelfStart]}
316-
onPress={() => setIsHidden(!isHidden)}
317-
>
318-
<Text
319-
style={styles.buttonSmallText}
320-
selectable={false}
321-
>
322-
{isHidden ? props.translate('moderation.revealMessage') : props.translate('moderation.hideMessage')}
323-
</Text>
324-
</Button>
325-
)}
326316
</ShowContextMenuContext.Provider>
327317
);
328318
}

0 commit comments

Comments
 (0)