fix: 400 error editing posts and comment

This is a backport from the master
This commit is contained in:
alipov_d
2023-06-07 13:44:57 +02:00
parent 0f7921ad1e
commit 2563209ae3
2 changed files with 6 additions and 2 deletions

View File

@@ -55,7 +55,9 @@ function CommentEditor({
const initialValues = {
comment: comment.rawBody,
editReasonCode: comment?.lastEdit?.reasonCode || (userIsStaff ? 'violates-guidelines' : ''),
editReasonCode: comment?.lastEdit?.reasonCode || (
userIsStaff && canDisplayEditReason ? 'violates-guidelines' : undefined
),
};
const handleCloseEditor = (resetForm) => {

View File

@@ -138,7 +138,9 @@ function PostEditor({
follow: isEmpty(post?.following) ? true : post?.following,
anonymous: allowAnonymous ? false : undefined,
anonymousToPeers: allowAnonymousToPeers ? false : undefined,
editReasonCode: post?.lastEdit?.reasonCode || (userIsStaff ? 'violates-guidelines' : ''),
editReasonCode: post?.lastEdit?.reasonCode || (
userIsStaff && canDisplayEditReason ? 'violates-guidelines' : undefined
),
cohort: post?.cohort || 'default',
};