User talk:GeneralNotability/spihelper/Archives/2020/August
This is an archive of past discussions with User:GeneralNotability. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Multi-date processing FTW!
Wikipedia:Sockpuppet investigations/Brian K Horton had two dates, one of which was closed. I just used your script to archive the one that was closed and leave the other one alone. Handled everything automatically. Excellent work, thanks for doing this. -- RoySmith (talk) 12:10, 13 August 2020 (UTC)
What to expect
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
If you're using this version of the script, consider this to be using a development branch - there will be bugs, there may be issues. I'm doing my best to not leave the script unusable for any significant length of time, but it's absolutely possible that something will go wrong. If you do have a major issue (like the script not loading), check if I've updated the script recently - if I've touched it in the past few minutes, odds are I'm looking now. In return for the risk, you're getting new functionality and bugfixes pretty regularly (I hope). My plan is that once I'm done with this first burst of development, I'll make this script fairly stable and have a dev version of the script.
Changes from original version
The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
- Added ability to request global lock at SRG (sub-function of the block and tag command)
- Switched previous iffy regex-based check for whether an account is an IP with a call to an mw.util function
- Added 3X ban tag option
- Redid several API actions to use mediawiki API calls instead of manually building out the URLs and parsing the results
- Now can set an altmaster in addition to the main master
- Added basic edit conflict detection
- Added select/set all options to the block window
- Documented things as I went along
- Various code cleanups that were bugging me
- Archive button now only archives closed sections
- Rename-case and merge-case functionality
- Changed several functions to use async/await pattern so that we can properly order asynchronous actions
- Used JSDoc for TypeScript-like type checks
- Preview button for text boxes
- Tool correctly understands multi-section cases and lets you pick which section you want to modify
Feature requests
- use clerk status - User talk:Timotheus Canens/Archives/2018/4#SPI helper script update - Sir Sputnik
- Already Done with existing spihelper version
- automatically create sock categories when tagging - User talk:Timotheus Canens/Archives/2019/2#SPI Helper script update - Sir Sputnik
- Already Done with existing spihelper version
- SPI-Archive should archive all closed reports rather than all reports - User talk:Timotheus Canens/Archives/2019/3#SPI-Archive - Cabayi
- Done, the archive button now only archives closed reports.
- ability for the tool to file a global lock request at m:SRG - User talk:Timotheus Canens/Archives/2019/4#Another item for the SPI tool wishlist... - Cabayi, TheSandDoctor
- Done, it's now an option on the block/tag page
- use xwiki links in block notices - User talk:Timotheus Canens/Archives/2019/5#Script tweak? - {{u|TonyBallioni}
- using xwiki links for all links in SPI would make it easier for the global lock request above and for the xwiki reporting request below.
- Already Done with existing spihelper version
- manage the size of the archives - User talk:Timotheus Canens/Archives/2019/12#SPI Helper script update - Sir Sputnik
- Already Done with existing spihelper version
- documentation - User talk:Timotheus Canens/Archives/2020/5#spihelper.js - RoySmith
- warn if the case has been modified since it was been loaded - User talk:Timotheus Canens/Archives/2020/6#spihelper.js - Dreamy Jazz
- xwiki reporting - occasionally reports are filed on enwiki as if enwiki has authority over other wikis. These need to be passed to those wikis for attention or, for those wikis without checkusers, to m:SRCU - Cabayi
- If you've selected multiple options (say, "Note/comment" and "Close case") which both provide text boxes, just show a single text box. - RoySmith
- Done by GN
- In the blocking form, provide some shortcuts like, "uncheck all", "uncheck all that are already blocked", and a way to fill the same Tag choice in for all the socks, so you don't have to pick "Suspected sock" N times. - RoySmith
- Provide a preview for the text box. - RoySmith
- Done by GN
- Not sure if this is possible, but automatically purge the page instead of redirecting you to Special:Purge. - RoySmith
- Done, the link it gives you at the end still purges but it automatically purges the page on edit
- Handle multiple cases/days on a page. - RoySmith
- Done by GN - there's now a per-section dropbox at the top of the interface. There's also an "all sections" option which lets you block users from multiple sections, archive all eligible sections, and rename the case.
- On narrower monitors (I'm running 1280x1024) the req lock label and checkboxes spill over the edge of the main box. To mitigate this, consider removing the word "has" from the alt master dropdown options. The options are plenty clear without it, and we can conserve a bit of width that way. Another option might be to dynamically adjust the width of the username and duration textboxes based on screen width, though that might be a bit harder to implement. Sir Sputnik (talk) 20:57, 9 July 2020 (UTC)
- On second thought, I've just gone ahead implanted both changes myself at User:Sir Sputnik/spihelper update.js. Sir Sputnik (talk) 21:12, 9 July 2020 (UTC)
- Sir Sputnik, thanks, I've rolled those changes into my version as well now. GeneralNotability (talk) 21:33, 9 July 2020 (UTC)
- On second thought, I've just gone ahead implanted both changes myself at User:Sir Sputnik/spihelper update.js. Sir Sputnik (talk) 21:12, 9 July 2020 (UTC)
- Another possible idea would be to do a sanity check on CU endorsements. If there's no non-stale socks listed in either the current case or the archives, put up a "are you sure?" alert, ask for confirmation, and offer a text box into which you can explain why you think CU would be useful. Maybe also a button that pre-fills the text box with, "Just check for sleepers". -- RoySmith (talk) 14:13, 10 July 2020 (UTC)
- Automatically purge when using the one-click archiver. The longer way of archiving does this already, so it only makes sense to do it with one-click as well. --TheSandDoctor Talk 18:26, 11 July 2020 (UTC)
- TheSandDoctor, easy. Done GeneralNotability (talk) 18:55, 11 July 2020 (UTC)
- Make the case-move feature do a histmerge if needed. - Dreamy Jazz
- Done by GN - if you select "all sections" and "rename case" and the target case exists, it will do a histmerge (if you're an admin, at least. if not it will throw an error). Also, if you choose "rename" on an individual case section, it will just copy that section to the target case and provide an attribution link.
- global lock request - please link the master's username in the section title.
- m:Special:Permalink/20310839#Global lock for Moe szylak sock(s) filed from Wikipedia:Sockpuppet investigations/Moe szylak - Moe was blocked & locked months ago so wasn't in the list of linked users to be locked. As a result there's no link to Moe in the report. Doing it in my usual style I'd link to
Global lock for [[Special:CentralAuth/Moe szylak|Moe szylak]] sock(s)
- though the style nearly all the other reports would link to User:Moe szylak. I prefer the CentralAuth link as it shows the cross-wiki-ness of the account rather than linking to what is usually a non-existent user page on meta (m:User:Moe szylak) where the user has never edited (m:Special:Contributions/Moe szylak). Cabayi (talk) 13:29, 25 July 2020 (UTC)
- Cabayi, piece of cake, I'll try to add that later today. GeneralNotability (talk) 13:22, 26 July 2020 (UTC)
- Update block template to Template:Uw-sockblock. Callanecc (talk • contribs • logs) 05:58, 1 August 2020 (UTC)
- Done (a couple weeks ago, actually) GeneralNotability (talk) 18:36, 14 August 2020 (UTC)
- Would be good to have a selectable list of comments that are frequently used (i.e. types into the comment field) so that they don't need to be typed all the time. I'm thinking specifically of response templates like {{Confirmed-nc}}, {{subst:btc}}, {{Sblock}}, {{DiffsNeeded}} (and it's permutations) but also things like {{confirmed}} and {{duck}}. If it could be achieved as a select-to-insert type thing so that more than one could be picked and additional comments can still be typed that would be amazing. Callanecc (talk • contribs • logs) 06:12, 1 August 2020 (UTC)
- Callanecc, ooh, I like that, will try to knock it out this weekend. This will probably be done as part of RoySmith's suggestion above - unifying all of the comment boxes into one. GeneralNotability (talk) 15:04, 1 August 2020 (UTC)
- GeneralNotability, You should also make sure there's always a comment box. There are some paths (I think checking just "Block/tag socks") which currently leave you with no comment box at all. If you then decide you want to make a comment, you have to bail out and start again. -- RoySmith (talk) 15:25, 1 August 2020 (UTC)
- @GeneralNotability: Looks good. Thanks! Could you please add {{A note|CheckUser note}} too? Thanks again! Callanecc (talk • contribs • logs) 09:55, 2 August 2020 (UTC)
- Callanecc, done (could have sworn that I added it already, I definitely was thinking about it as I went through the list of recommended templates). Right now it shows up for everyone, I'm going to do a little work on the note templates to restrict what shows up for who. Also, apparently the comment I tried to make last night didn't post, so here it is: Note that the "comment" checkbox is no longer necessary, the comment box will always show up, it's basically only there for "I want to make a comment but do nothing else". The CU-specific actions list ( Confirmed, etc.) is restricted to only show for CUs. If you look at the diff you might also find a few hints about upcoming features...ehehehe... Courtesy ping RoySmith too. GeneralNotability (talk) 13:10, 2 August 2020 (UTC)
- Callanecc, heads up - there was a bug last night which caused comments to not get added (I forgot to remove the "only comment if the comment box was checked initially" logic). Pinging you since it looks like you tried to make comments at Wikipedia:Sockpuppet_investigations/Derbyboy2890 and Wikipedia:Sockpuppet investigations/KhetiGaadi01 which didn't show up...sorry about that. GeneralNotability (talk) 00:40, 3 August 2020 (UTC)
- Callanecc, done (could have sworn that I added it already, I definitely was thinking about it as I went through the list of recommended templates). Right now it shows up for everyone, I'm going to do a little work on the note templates to restrict what shows up for who. Also, apparently the comment I tried to make last night didn't post, so here it is: Note that the "comment" checkbox is no longer necessary, the comment box will always show up, it's basically only there for "I want to make a comment but do nothing else". The CU-specific actions list ( Confirmed, etc.) is restricted to only show for CUs. If you look at the diff you might also find a few hints about upcoming features...ehehehe... Courtesy ping RoySmith too. GeneralNotability (talk) 13:10, 2 August 2020 (UTC)
- @GeneralNotability: Looks good. Thanks! Could you please add {{A note|CheckUser note}} too? Thanks again! Callanecc (talk • contribs • logs) 09:55, 2 August 2020 (UTC)
- GeneralNotability, You should also make sure there's always a comment box. There are some paths (I think checking just "Block/tag socks") which currently leave you with no comment box at all. If you then decide you want to make a comment, you have to bail out and start again. -- RoySmith (talk) 15:25, 1 August 2020 (UTC)
- Callanecc, ooh, I like that, will try to knock it out this weekend. This will probably be done as part of RoySmith's suggestion above - unifying all of the comment boxes into one. GeneralNotability (talk) 15:04, 1 August 2020 (UTC)
- From Mz7: Mark rangeblocks with {{rangeblock}}.
- Done (also, I didn't exactly document it before, but you can apply rangeblocks either by setting an IP range as the checkip argument or by manually adding the CIDR mask in in the block interface). GeneralNotability (talk) 15:01, 1 August 2020 (UTC)
Version 2.1.0 "Embrace Weasel Words" released
I've released version 2.1.0, a feature update to the previous release. Thanks to Mdaniels5757 for pointing out the issue which led to this release (and inspired a couple of the features that I added - you'll want to have a look at the changelog).
changelog |
---|
The following discussion has been closed. Please do not modify it. |
|
As usual, please let me know if you find any bugs. GeneralNotability (talk) 17:22, 13 August 2020 (UTC)
- GeneralNotability, Not a bug per-se, but see this edit. I forgot to select the Clerk Note before I started typing, and when I went back and added it, it got stuck at the end (i.e. wherever the text insertion point happened to be) and I didn't notice. Maybe it makes sense to always force these icons to go at the front, no matter where the insertion point is? There may be cases where that's not correct, so this may be half-baked. Just a suggestion. -- RoySmith (talk) 17:06, 15 August 2020 (UTC)
- GeneralNotability, see attached screenshot; the top row in the block/tag has no username or duration. This was on this revision -- RoySmith (talk) 11:50, 16 August 2020 (UTC)
- RoySmith, intentional, that's the "select all/set all" row. I could make that clearer by adding a horizontal line or something below it, will work on that. GeneralNotability (talk) 20:34, 16 August 2020 (UTC)
- GeneralNotability, Ah, that makes sense. Yeah, just something to set it off visually would work. -- RoySmith (talk) 20:39, 16 August 2020 (UTC)
- RoySmith, intentional, that's the "select all/set all" row. I could make that clearer by adding a horizontal line or something below it, will work on that. GeneralNotability (talk) 20:34, 16 August 2020 (UTC)
Case move?
I used this to move Wikipedia:Sockpuppet investigations/StraightFromTheHorsesMouth to Wikipedia:Sockpuppet investigations/Asgard0392. Shouldn't it have also updated the {{SPIarchive notice}} to point to the new case? -- RoySmith (talk) 00:47, 17 August 2020 (UTC)
- RoySmith, there are two different modes for moving a case. If you have just one section selected in the drop-down, it will just move that section and the edit summary will attribute the move to the original case (this is for when a case is filed under one sockmaster but it's actually a different sockmaster). If you have "All sections" selected, it will move the entire case (either a move or histmerge as appropriate). I know this distinction isn't super obvious at first glance, so if you have suggestions on how to make that more clear, I'm definitely interested in hearing it. GeneralNotability (talk) 01:03, 17 August 2020 (UTC)
- GeneralNotability, Ah, OK. What's the best way forward here? Just move it again, even though it's empty now? -- RoySmith (talk) 01:05, 17 August 2020 (UTC)
- RoySmith, might be better to delete Asgard0392, revert StraightFromTheHorsesMouth to pre-move, and then move again - I'm concerned that moving it a second time as you suggested would make weird things happen in the history. GeneralNotability (talk) 01:07, 17 August 2020 (UTC)
- GeneralNotability, That worked, thanks. -- RoySmith (talk) 01:15, 17 August 2020 (UTC)
- RoySmith, might be better to delete Asgard0392, revert StraightFromTheHorsesMouth to pre-move, and then move again - I'm concerned that moving it a second time as you suggested would make weird things happen in the history. GeneralNotability (talk) 01:07, 17 August 2020 (UTC)
- GeneralNotability, Ah, OK. What's the best way forward here? Just move it again, even though it's empty now? -- RoySmith (talk) 01:05, 17 August 2020 (UTC)
Some suggestions
A user script written entirely in ES2017? Exciting! Anyway, a few comments on a casual read-through of the code:
- for the sake of code sanity, wrap the entire script in (commented-out) nowiki tags, so that you don't have to write things like
'{' + '{template}}'
.'{{template}}'
and~~~~
will just work. - line 40:
spiHelper_loadSettings();
Did you meanawait spiHelper_loadSettings();
?
- If those settings change the display of the form, they may not work as settings may not be loaded in time.
- first occurrence on line 432:
(<a href="/wiki/' + encodeURI(spiHelper_pageName)
- The right function is encodeURIComponent. However on mediawiki environs, it's better to just use
'href=' + mw.util.getUrl(spiHelper_pageName)
- The right function is encodeURIComponent. However on mediawiki environs, it's better to just use
- lines 926-7:
const dateString = now.toLocaleString('en', { month: 'long' }) + ' ' + now.toLocaleString('en', { year: 'numeric' });
- Use utc: 'true' option, otherwise it's the user's local time that'll be logged!
- line 1582:
function escapeHtmlChars
THis is identical to mw.html.escape - line 1785:
let text = '<select name="' + title + '" id="' + title + '" ';
- This is asking for trouble. What if the title contains a double quote?
- It's better to make use of jQuery to construct HTML. It also guards against XSS vulnerabilities, in addition to handling the escapings.
- line 1978 and many other places:
mw.config.get('wgCategories').toString().includes('SPI cases awaiting archive')
- toString() is unnecessary.
- Use of onchange and onclick HTML attributes is frowned upon in modern javascript. It's better to attach event listeners using addEventListener() function.
- Better to use a CSS stylesheet for styling rather than repeating inline styles dozens of times.
SD0001 (talk) 14:29, 20 August 2020 (UTC)
- SD0001, thanks! I can blame Timotheus's original script for a few of those oddities, but most of those issues are just because I'm still fairly new to Javascript :). I'll try to work on fixing those up. GeneralNotability (talk) 14:39, 20 August 2020 (UTC)
Stopping editors from modifying CU blocks using the tool without meaning to
I have, without meaning to, modified CU blocks using the tool before. I have some ideas which you can take or leave on this:
- If the block summary on a already blocked account contains "{{Checkuserblock-account}}" or similar templates, or the words "checkuser" / "checkuser block" then the script should either warn and ask the user to confirm they want to change it / or skip over re-blocking the account. The policy on this, WP:CUBL, says that non-CUs should not modify blocks
that [are] specifically identified as a "checkuser" block
. This suggests to me that the templates are not the only thing which can be used to mark a CU block, so checking for the words "checkuser" / "checkuser block" / "CU block" / "CU" might be a good idea. - Leave the override blocks option off by default. I often find that I don't want to override blocks, or at least not override indefinite blocks. Usually the tag on the userpage is enough, but in cases of no tags perhaps overriding blocks is more useful. This means a user of the script will have to explicitly check the box, so (I presume) a large proportion of the accidental modifications will be prevented. Dreamy Jazz talk to me | my contributions 15:48, 20 August 2020 (UTC)
- And in regards to the first suggestion, I suggest a popup is used to ask the user if they want to override the CU block. This is because the block summary may contain the words "checkuser" but not be a checkuser block. Dreamy Jazz talk to me | my contributions 15:54, 20 August 2020 (UTC)
- Dreamy Jazz, yup, as soon as I saw that message I started working on a feature like this :) I'll have it deployed to my development version shortly, I'm hoping that I'll have a 2.2 release in the next week or so with this and some other stuff I've been working on. GeneralNotability (talk) 16:27, 20 August 2020 (UTC)
Version 2.2.0 "ANI Flu" released
In which GeneralNotability discovers JQuery and probably uses altogether too much of it.
changelog |
---|
The following discussion has been closed. Please do not modify it. |
User-facing changes
Technical changes
|
GeneralNotability (talk) 00:05, 24 August 2020 (UTC)
- Thanks for this version. The "back to top menu" option is particularly useful. Dreamy Jazz talk to me | my contributions 21:14, 24 August 2020 (UTC)
- GeneralNotability, I'm particularly loving the auto-purge. And, I just noticed the "Clerk note" template is forced to the beginning, which is another serving of love. Thanks. -- RoySmith (talk) 15:49, 25 August 2020 (UTC)