-
-
Notifications
You must be signed in to change notification settings - Fork 1k
SAK-51027 Discussions Date read-only option toggles Lock Topic, requi… #14335
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
base: master
Are you sure you want to change the base?
Conversation
…res instructor to disable in order to update dates
WalkthroughRefactored locking: bean getters/setters now use direct boolean checks and null-safe comparisons; JSPs read lock state from selected beans; locking/availability/close-date logic centralized into manager/permissions helpers; added defensive unlock when saving topic settings with changed close dates. Changes
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.40.5)msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.javaThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/MessageForumsMessageManagerImpl.java (1)
1756-1791: Replace debug logging with SLF4J parameterized format.Line 1762 uses string concatenation in logging:
log.debug("isForumLocked executing with forumId: " + forumId + ":: topicId: " + topicId);. Use parameterized logging instead:log.debug("isForumLocked executing with forumId: {} :: topicId: {}", forumId, topicId);per the Java coding guidelines.
🧹 Nitpick comments (1)
msgcntr/messageforums-component-impl/src/java/org/sakaiproject/component/app/messageforums/ui/UIPermissionsManagerImpl.java (1)
307-320: RedundantisLocked(topic)check.Line 311 already returns
falseif the topic is locked, so the!isLocked(topic)check on line 316 is always true when reached and can be removed. The same redundancy appears inisDeleteAny,isDeleteOwn, andisMarkAsRead.♻️ Suggested simplification
public boolean isReviseOwn(DiscussionTopic topic, DiscussionForum forum, String userId, String contextId) { if (checkBaseConditions(topic, forum, userId, contextId)) return true; if (isLocked(topic)) return false; if (!forum.getDraft() && !isLocked(forum) - && !topic.getDraft() - && !isLocked(topic)) { + && !topic.getDraft()) { return getTopicItemsByUser(topic, userId, contextId).stream().anyMatch(ifReviseOwn); } return false; }
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java`:
- Around line 2123-2133: The current block in DiscussionForumTool
unconditionally clears topic locks when editing a close date into the future,
which also clears instructor-set manual locks; instead, load the
persisted/original topic close date (e.g., fetch the stored Topic by id as
persistedTopic or existingTopic before applying edits) and only auto-unlock if
the persisted closeDate existed and was in the past (persistedCloseDate != null
&& persistedCloseDate.before(new Date())) and the topic has lockedAfterClosed
true; otherwise leave topic.getLocked() untouched so manual locks are preserved.
Ensure null checks for persistedCloseDate and use the same
selectedTopic.setTopicLocked(false) only in the auto-unlock case.
…res instructor to disable in order to update dates
Summary by CodeRabbit
Bug Fixes
Behavior
✏️ Tip: You can customize this high-level summary in your review settings.