refactor: structure the edit reason code condition
This commit is contained in:
@@ -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 && {
|
||||
|
||||
@@ -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 && {
|
||||
|
||||
Reference in New Issue
Block a user