User:GeneralNotability/spihelper

This is spihelper, a script to help CheckUsers, SPI clerks, and patrolling admins with sockpuppet investigation case pages.

How to install

 * Method 1 – Automatic
 * 1) Go in the 'Gadgets' tab of your preferences and select the 'Install scripts without having to edit JavaScript files' option at the bottom of the 'Editing' section.
 * 2) Click on the 'Install' button in the infobox on the right, or at the top of the source page.
 * Method 2 – Manual
 * 1) Go to Special:MyPage/common.js. Alternatively, you can go to Special:MyPage/skin.js to make the script apply only to your current skin.
 * 2) Add  to the page  (you may need to create it).
 * 3) Save the page and bypass your cache to make sure the changes take effect.

How it works
To use spihelper, navigate to a sockpuppet investigations case page (it must have at least one active case), and then navigate to the "SPI" link on your navigation bar (on the Vector skin, this will be at the top right of your screen, possibly under the "More" drop-down". There may also be an SPI-Archive button, more on that later.

Top menu
The initial menu has several inputs. Your selections here will determine which actions are presented to you later. You will have a section selection drop-down with one entry per case section, plus an "All sections" option. You also will have the following checkboxes, some of which may be disabled depending on the current status of the case: Once you click "Continue," you will be presented with actions to take based on which boxes you checked.
 * Change case status (request or decline checkuser, request clerk action, etc., this also has space for comments)
 * Block/tag socks (for non-admin users, this will just say "Tag socks")
 * Note/comment (add a clerk or administrator note to the case)
 * Close case (also has space for comments)
 * Move/merge case (if "all sections" is selected) or Move case section (if a specific section is selected). Should only be used by clerks and checkusers.
 * Archive case

Case status
This lets you change the case status, such as requesting, endorsing, or declining checkuser, requesting more information, or placing the case on hold. The available options will depend on the current case status - for example, you can't decline checkuser if checkuser has not been requested.

Block/tag socks
This interface allows you to block and tag socks. The list of possible socks is generated by searching the section's text for usernames in the following templates:
 * checkuser and checkip - these will have the block button automatically checked.
 * user, vandal, ip - these will not have the block button automatically checked.

This section has a number of boxes to check. Some of the less-obvious ones:
 * The row of checkboxes and drop-downs at the top will set that for all socks (e.g. checking the top "Blk" box will check the block box for all socks).
 * Override existing blocks: will reblock a user if they are already blocked. Checked by default. This is useful, for example, to change existing temporary blocks to indefinite, or change a block reason to sockpuppetry.
 * Hide usernames when requesting global locks: exactly what it sounds like, this is useful if usernames are particularly offensive.
 * Req lock: files a lock request at Stewards' noticeboard, you should usually request locks if the sockmaster is already globally locked.
 * Alt master: if a case has confirmed a group of socks to one master but there is suspicion that the case may actually be a different sockmaster, set this. It will add a sockpuppet tag on the master and use the altmaster option on the other sockpuppets. Setting this to anything except "None" will prompt you for the name of the alternate master.
 * ACB: account creation blocked, if this is set the blocked user can't create new accounts. Checked by default.
 * AB/AO: autoblock/anonymous-only. For logged-in users, this sets autoblock so that new accounts from the same IP will also be blocked. For IPs, this sets the block as anonymous-only, so it will not affect users editing from the same IP. Checked by default.
 * NTP: no talk page access. User can't edit their talk page. Unchecked by default, usually should only be used for sockmasters known to abuse their talk page access.
 * NEM: no email, user can't use Special:EmailUser. As above, unchecked by default, should be reserved for sockmasters known to abuse email.

Comment
You only need to select this if you only want to comment - all actions will open the comment box anyway (it won't hurt anything if you do select it, though). Has drop-downs for frequently used templates. If you are an admin, checkuser, or have clerk set to true, the comment will go in the "clerks, checkusers, and patrolling admin" section, otherwise the comment will go in the "comments by other users" section.

Close case
Closes the case.

Move/merge case
You will be prompted for the name of the new sockmaster. This function has different behavior depending on whether "All sections" or a specific section was selected.

All sections
If the target page does not exist, this will move the investigation to that page. If the target page exists, this will perform a history merge (delete the target page, move this page, restore the target page's history). In the latter case, the script will check if you are an admin - if you are, it will request confirmation, if you are not it will stop editing (since non-admins can't do history merges). In either case it will also leave an SPIarchive notice at the old page with the new case name and add the previous sockmaster to the socks list for the new case.

Specific section
''This option is disabled by default. See for directions on how to enable it. Don't enable it unless you understand the difference between this option and the one above.''

The section will be moved to the target case via a cut-and-paste move (the edit summary will link to the current case for attribution). If there was not a page there before this will add the basic sockpuppet templates (archive notice and prior cases) to the page as well. This option should be used if a specific section was filed against the wrong sockmaster and belongs under a different one (for example, a case is filed under longtime sockmaster A but checkuser indicates that the socks are actually other longtime sockmaster B), but the case as a whole should stay where it is.

Archive case
If a specific section is selected, it will be archived. If "All sections" is selected, all cases with the status "closed" will be archived.

SPI-Archive
This button only appears when at least one case has the "closed" status. It archives all closed cases.

Feature requests and bug reports
Make them on the github page (if you don't have a GitHub account, you can leave a message on the talk page and I'll file it for you).

Config file
There are a handful of user-configurable settings in spihelper. To change them, create Special:MyPage/spihelper-options.js with the following content: You only need to include settings you want to change from their spihelper defaults. Explanations of the various settings:
 * watchCase/watchArchive/watchTaggedUser: whether you want to watch the case page, archive page, and any blocked or tagged users' pages after editing them. Possible values:
 * 'watch' - always watch the pages
 * 'preferences' - follow your default FAMEPedia preferences (usually means you will watch the page if you are newly creating it)
 * 'nochange' - don't change the watchlist setting from what it was before you edited
 * 'unwatch' - always unwatch the page (I have no idea why you'd want to do this)
 * watchBlockedUser: boolean for whether or not you want to watch users you've blocked.
 * watchCaseExpiry/watchArchiveExpiry/watchTaggedUserExpiry/watchNewCatsExpiry/watchBlockedUserExpiry: if one of your edits would add one of these pages to your watchlist, sets how long to watch them for. Defaults to "indefinite" (the normal "watchlist forever" behavior). The standard MediaWiki date/time parser is behind this, so natural language values like "2 weeks" or "one year" should work. Also accepts a fixed date in the future, if you want to do that for some reason.
 * log: Creates a log of your spihelper actions at Special:MyPage/spihelper_log. Great for clerk trainees!
 * clerk: Shows you clerk-related tasks. Defaults to true, so this is just for use if you're not a clerk and don't want to risk using a clerk-only button.
 * iUnderstandSectionMoves: If you are a clerk or checkuser, un-disables the "Move case section" button. This was added because a lot of people were clicking "Move case section" instead of "Move/merge full case." You know who you are.

Relation to User:Timotheus Canens/spihelper.js
This script began as a handful of feature patches to Timotheus Canens's spihelper.js script, but expanded into a significant rewrite, modernization, and feature expansion. Credit for the original idea and most of the script's "bones" goes to Tim, I wouldn't have been able to write this from scratch.