The discussion addresses the need for efficient bulk topic selection in Discourse, particularly for moderation tasks like moving or deleting thousands of topics. Maestra_Powers initially sought a “Shift+click” feature to select ranges of topics but found the native tool lacking. Community members suggested temporary workarounds, such as running jQuery snippets in the developer console to check all boxes cpradio and sigurdur, or simulating clicks via JavaScript ossi. However, Maestra_Powers noted these methods often failed to trigger the UI correctly or broke when async content loaded, prompting a custom but fragile script. eviltrout and codinghorror cautioned against relying on raw jQuery hacks, recommending the creation of a proper Discourse plugin instead, though they acknowledged the technical difficulty due to the topic list’s optimization. For enterprise-scale operations involving tens of thousands of topics, direct database manipulation or SQL scripts were suggested as the only viable performance solution Falco. The thread concluded with techAPJ announcing that a native feature to select all currently visible topics has been implemented via a recent commit, partially addressing the user’s request.
I need to move all topics from one category to another now, so do I need to click on each checkbox for this? Or is there a faster way? I hoped there’s Shift+click thing, but nope. Maybe there’s another hotkey for this that I don’t know?
I feel like if we add that callback we’ll regret it. I know it seems easier to just throw in some jQuery code to update the page but if anyone relies on that it can easily break when we update the ember code underneath.
Giving that hook gives the impression that it is an OK way to do things, when in fact it is hacky.
It is hacky. I understand that I will have to fix this code each time you’ll change some HTML around. But I’ll have to deal with it sinse there’s few things that I don’t like about Discourse now, and there’s no other way to fix them. I will probably have to use JS to fix all of this:
Just tried to use my code - didn’t worked. Checkboxes changes state but admin tool still shows I selected only 2 topics. None of this works too:
So I chagned it to send click to checkbox instead - it works this way, but my code glitches now because it triggers itself and as result you can’t select more than 67 topics at once. Will fix it later.
And yea - script breaks somehow after async content been loaded. Although it says $(document).on which means it should catch element even if it’s not on the document when script shoots. Need to find out how to switch from jQuery’s $(document).ready to Ember’s voodoo magic, as @sam said.
Not true. There is a proper way to extend Discourse rather than raw jQuery and that’s by writing a Discourse plugin. I’d happily point you towards many examples. Using jQuery to write them is a mistake.
This is unfortumately trickier to do because the topic list item has been optimized to use raw handlebars and not ember. Normally you could add all of the topics to the controller.selected array but it doesn’t look like @Sam’s raw’s refactor handles binding that way.
In other words, even if you knew Ember well it would be hard to write this particular feature as a plugin.
Most of our plugins live in the discourse organization on github. I’d suggest looking at. Most are pretty simple and should give you an idea of how we extend discourse. Let me know if you have any questions.
When I looked at it, it didn’t seem to be bound to the selected collection though. They’d have to set up an observer to do that.
I think making Shift+click to select multiple topics would be a great usability enhancement. Gmail, among many other web apps, implements this convenience.
However, I had to manually check one box for the topic management icon to show up. And then, even though all the topics appeared to be selected, when I tried to bulk set a tag, nothing happened.
Just wondering what the experience of others has been.