Skip to content

Conversation

@duartegalvao
Copy link
Member

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.
image

@ThiefMaster
Copy link
Member

ThiefMaster commented Aug 8, 2024

image

shouldn't this also be disabled? (saving it failed of course, since it was outdated because i reverted a revision in the other tab)

@duartegalvao
Copy link
Member Author

duartegalvao commented Aug 9, 2024

shouldn't this also be disabled? (saving it failed of course, since it was outdated because i reverted a revision in the other tab)

indeed it should, I'll fix it

<Popup
trigger={
<div className="flexrow f-a-center" styleName="judgment-form">
<CommentForm onSubmit={createComment} onToggleExpand={setCommentFormVisible} />
Copy link
Member Author

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...

Copy link
Member

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">

Copy link
Member Author

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

@micsucmed micsucmed force-pushed the disable-outdated-timeline branch from 0c0a8ee to 17b400b Compare September 9, 2025 13:46
@github-project-automation github-project-automation bot moved this from Under Review to Done 🚀 in JACoW suggestions to Indico Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done 🚀

Development

Successfully merging this pull request may close these issues.

3 participants