Jump to content

User talk:GeneralNotability/spihelper/Archives/2020/August

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia


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.

The discussion above 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.

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
The discussion above 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.

Feature requests

  • 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)

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.
  • The "clerk" setting in your options file now is used correctly.
  • Several checks have been added to prevent you from being able to select options you shouldn't be using. In particular, non-clerks now cannot use the archive buttons.
  • Non-clerk non-admins (whom I'd never expected to use this script, thank you Mdaniels for proving that assumption incorrect) now will only be able to use features they should have access to (commenting and requesting CU). When commenting, these users' comments will go in the "comments by other users" section.

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)

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)

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 mean await 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)
  • 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

  • Text box now starts out with a '*' instead of quietly prepending it like before - this makes it clearer what will actually be added as a comment.
  • "Override existing blocks" is no longer checked by default.
  • If you try to override a CU block (defined as a block containing any of {{checkuserblock-account}}, {{checkuserblock-account}}, or {{checkuserblock-wide}}) and you're not a CU, you will be prompted to confirm instead of silently overriding a checkuser block. Thanks to NinjaRobotPirate for, uh, pointing this flaw out to me.
  • Options you don't have access to in the top view (e.g. archive for non-clerks) now aren't displayed at all instead of just being grayed out.
  • If you create a sock category, we go back and purge all of the tagged userpages so that you don't see the "click here to create category" prompt
  • Following a case move, remove the new sockmaster from the "suspected sockpuppets" list
  • Fixed double-signature detection.

Technical changes

  • Switched to using JQuery for modifying the displayed page instead of manually generating HTML.
  • Did a bunch of cleanup suggested by SD0001 - don't complain about the remaining toString() calls, they're guaranteeing that a union type turns into a string.
  • The views are now big chunks of pre-defined HTML which we tweak at runtime instead of building them piece-by-piece.
  • Wrapped everything in nowiki tags so we don't have to do weird things to prevent templates from rendering.
  • Turned a giant shared global object into a bunch of function-scoped vars.

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)