fix: hide edit reason dropdown while adding a comment or response (#142)
* fix: hide edit reason dropdown while adding a comment or response
This commit is contained in:
@@ -112,6 +112,7 @@ function Comment({
|
||||
threadId: comment.threadId,
|
||||
parentId: comment.id,
|
||||
}}
|
||||
edit={false}
|
||||
onCloseEditor={() => setReplying(false)}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -20,6 +20,7 @@ function CommentEditor({
|
||||
intl,
|
||||
comment,
|
||||
onCloseEditor,
|
||||
edit,
|
||||
}) {
|
||||
const { authenticatedUser } = useContext(AppContext);
|
||||
const userIsPrivileged = useSelector(selectUserIsPrivileged);
|
||||
@@ -65,7 +66,9 @@ function CommentEditor({
|
||||
<Form onSubmit={handleSubmit}>
|
||||
{(reasonCodesEnabled
|
||||
&& userIsPrivileged
|
||||
&& comment.author !== authenticatedUser.username) && (
|
||||
&& comment.author !== authenticatedUser.username
|
||||
&& edit
|
||||
) && (
|
||||
<Form.Group>
|
||||
<Form.Control
|
||||
name="editReasonCode"
|
||||
@@ -142,6 +145,11 @@ CommentEditor.propTypes = {
|
||||
}).isRequired,
|
||||
onCloseEditor: PropTypes.func.isRequired,
|
||||
intl: intlShape.isRequired,
|
||||
edit: PropTypes.bool,
|
||||
};
|
||||
|
||||
CommentEditor.defaultProps = {
|
||||
edit: true,
|
||||
};
|
||||
|
||||
export default injectIntl(CommentEditor);
|
||||
|
||||
@@ -14,7 +14,11 @@ function ResponseEditor({
|
||||
const [addingResponse, setAddingResponse] = useState(false);
|
||||
return addingResponse
|
||||
? (
|
||||
<CommentEditor comment={{ threadId: postId }} onCloseEditor={() => setAddingResponse(false)} />
|
||||
<CommentEditor
|
||||
comment={{ threadId: postId }}
|
||||
edit={false}
|
||||
onCloseEditor={() => setAddingResponse(false)}
|
||||
/>
|
||||
) : (
|
||||
<div className="actions d-flex">
|
||||
<Button variant="primary" onClick={() => setAddingResponse(true)}>
|
||||
|
||||
Reference in New Issue
Block a user