refactor: structure the edit reason code condition

This commit is contained in:
Awais Ansari
2022-04-21 23:53:56 +05:00
parent bea2390b4d
commit 11f98d32a1
2 changed files with 4 additions and 4 deletions

View File

@@ -29,8 +29,8 @@ function CommentEditor({
const { reasonCodesEnabled, editReasons } = useSelector(selectModerationSettings);
const [submitting, dispatch] = useDispatchWithState();
const canDisplayEditReason = (reasonCodesEnabled && userIsPrivileged && edit
&& comment.author !== authenticatedUser.username
const canDisplayEditReason = (reasonCodesEnabled && userIsPrivileged
&& edit && comment.author !== authenticatedUser.username
);
const editReasonCodeValidation = canDisplayEditReason && {

View File

@@ -91,8 +91,8 @@ function PostEditor({
const { allowAnonymous, allowAnonymousToPeers } = useSelector(selectAnonymousPostingConfig);
const { reasonCodesEnabled, editReasons } = useSelector(selectModerationSettings);
const canDisplayEditReason = (reasonCodesEnabled && editExisting && userIsPrivileged
&& post.author !== authenticatedUser.username
const canDisplayEditReason = (reasonCodesEnabled && editExisting
&& userIsPrivileged && post.author !== authenticatedUser.username
);
const editReasonCodeValidation = canDisplayEditReason && {