[3.0] Give each post one quick-moderation checkbox, and no empty submit - #9478
Open
albertlast wants to merge 2 commits into
Open
[3.0] Give each post one quick-moderation checkbox, and no empty submit#9478albertlast wants to merge 2 commits into
albertlast wants to merge 2 commits into
Conversation
A topic draws two of these strips, one for the page and one for the mobile menu, and both instances append their own checkbox to the same container. So every post carried two of them side by side, and ticking one left the other strip's count wrong. Reuse whatever checkbox is already in the container and just listen to it as well. 2.1 built the Remove/Restore/Split buttons on the first checkbox click. 3.0 moved that block into init(), which left them on screen from page load, with nothing selected and no count. Pressing one then submitted the form with no msgs[] at all, and quickmod2 read $_REQUEST['msgs'] unguarded: a blank page, an undefined key and array_map() on null. Show the buttons from the same place that already counts, so they start hidden, and let the action redirect back to the topic if it is handed nothing. The move also left the else branch assigning to oNewDiv, which is not declared anywhere. Signed-off-by: Mathias Papenbrock <mathiaspapealbert@hotmail.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Closed
live627
reviewed
Aug 10, 2026
Review asked for the selector to come out of the loop. The scoped call could not move as it stood, since the container it looks inside is a different element on every pass, so this queries the document once and indexes what it finds by the message id each checkbox carries. This file is the only thing that emits a msgs[] input, so an unscoped query has nothing else to pick up. Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
With Show quick-moderation as: checkboxes turned on in a member's look-and-layout options, the topic display has three related problems. All of them come from
InTopicModerationintopic.js.Two checkboxes beside every post.
Display.template.phpconstructs the widget twice - once formoderationbuttonsand once formoderationbuttons_mobile- and both instances run the same loop appending a freshmsgs[]checkbox to the samein_topic_mod_check_<id>container. Measured on a 15-post page: 15 containers, 2 checkboxes each. Ticking one also only updates its own instance's counter, so the other strip's button reads[0].The buttons work with nothing selected. In 2.1 the Remove/Restore/Split buttons were created inside
handleClick(), guarded bybButtonsShown, so they did not exist until something was ticked. 3.0 moved that block intoinit()and dropped the guard -this.bButtonsShownis still assigned in the constructor and now never read. The buttons therefore appear at page load, with no count, and pressing one submitsquickModFormwith nomsgs[]:and the member gets a blank page.
QuickModerationInTopic::__construct()reads$_REQUEST['msgs']unguarded; all three sub-actions then need a non-empty list anyway (split()takesmin()of it, the other two hand it to an{array_int:...}), so the action now redirects back to the topic when given nothing.A stray variable. The same move left the
elsebranch ininit()assigning tooNewDiv, which is not declared anywhere - aReferenceErrorif the button strip's display element is ever missing.How to test
Profile → Look and Layout → Show quick-moderation as: Checkboxes. Open a topic.
smf_log_errors.[1],[2], … on both strips; the split-selected flow completes with an empty error log.Issues References (Fixes|Related|Closes)
Found while sweeping the topic display for the #7933 split.