-
Notifications
You must be signed in to change notification settings - Fork 510
Disable judgments when timeline is disabled #6459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable judgments when timeline is disabled #6459
Conversation
indeed it should, I'll fix it |
| <Popup | ||
| trigger={ | ||
| <div className="flexrow f-a-center" styleName="judgment-form"> | ||
| <CommentForm onSubmit={createComment} onToggleExpand={setCommentFormVisible} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find a way to pass a disabled prop to the CommentForm without resetting its state...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this what you need here? (didn't bother with proptypes to test this ;))
diff --git a/indico/modules/events/editing/client/js/editing/timeline/CommentForm.jsx b/indico/modules/events/editing/client/js/editing/timeline/CommentForm.jsx
index 2378acd0ba..0da6e66771 100644
--- a/indico/modules/events/editing/client/js/editing/timeline/CommentForm.jsx
+++ b/indico/modules/events/editing/client/js/editing/timeline/CommentForm.jsx
@@ -18,7 +18,7 @@ import {getDetails} from './selectors';
import './CommentForm.module.scss';
-export default function CommentForm({onSubmit, onToggleExpand, initialValues, expanded}) {
+export default function CommentForm({onSubmit, onToggleExpand, initialValues, expanded, disabled}) {
const {canCreateInternalComments} = useSelector(getDetails);
const [commentFormVisible, setCommentFormVisible] = useState(expanded);
@@ -67,7 +67,7 @@ export default function CommentForm({onSubmit, onToggleExpand, initialValues, ex
/>
)}
<Form.Group styleName="submit-buttons" inline>
- <FinalSubmitButton label={Translate.string('Comment')} />
+ <FinalSubmitButton label={Translate.string('Comment')} disabled={disabled} />
<Button
disabled={fprops.submitting}
content={Translate.string('Cancel')}
diff --git a/indico/modules/events/editing/client/js/editing/timeline/ReviewForm.jsx b/indico/modules/events/editing/client/js/editing/timeline/ReviewForm.jsx
index 0817eddea6..2be19abfe6 100644
--- a/indico/modules/events/editing/client/js/editing/timeline/ReviewForm.jsx
+++ b/indico/modules/events/editing/client/js/editing/timeline/ReviewForm.jsx
@@ -102,7 +102,11 @@ export default function ReviewForm() {
<Popup
trigger={
<div className="flexrow f-a-center" styleName="judgment-form">
- <CommentForm onSubmit={createComment} onToggleExpand={setCommentFormVisible} />
+ <CommentForm
+ onSubmit={createComment}
+ onToggleExpand={setCommentFormVisible}
+ disabled={isOutdated}
+ />
{canPerformSubmitterActions && canReview && !editor && (
<>
<span className="comment-or-review">There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats what I did, at least for me this clears the form when the timeline becomes outdated. not sure why
0c0a8ee to
17b400b
Compare
Improve notification placement

This PR disables all editing actions on the timeline when it is detected that it became outdated, avoiding errors due to editing actions on the wrong revision.
