-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
morebits: Add support for change/revisions tags, remove customization…
… of summaryAd Defines `Twinkle.changeTags = 'twinkle'` in twinkle.js and applies that across the board. There are a lot of actions, only some of which support applying tags. For a full list, search for `ApiBase::PARAM_TYPE => 'tags'` (in core; for extensions use something like that e.g. `::PARAM_TYPE => 'tags'`). The fullish list is: * block * changecontentmodel * delete * edit * import * managetags * move * patrol * protect * revisiondelete * rollback * setlanguagepage * tag * unblock * undelete * upload * userrights Basically the majority of the "write modules." Others that support `tags`: globaluserrights, the Wiki Love extension, and various WikiBase APIs; notable exceptions for our purposes are PageTriage (T252980) and FlaggedRevs (T247721). This implementation weeds out the most common/likely for our purposes: checking against the full supported list is unwieldy, and largely unnecessary as the error message is harmless. If we did want to check everything, we'd just dump that list into an object and verify the relevant action. This also deprecates the `summaryAd` preferences. `summaryAd`, `deletionSummaryAd`, and `protectionSummaryAd` have been retained in twinkle.js' `defaultConfig` as backups when a tag isn't used (e.g. add-on scripts, installations that don't want to use a tag), but this also formally removes them as preferences to be selected from `twinkleconfig.js`. `deletionSummaryAd` and `protectionSummaryAd` should be removed entirely IMO, in favor of just one "ad" that could itself be better integrated. ---- At first blush it would seem to be simpler to just do something like we do for the useragent, that is: ``` Morebits.wiki.api.setActionTag = function(tag) { morebitsWikiActionTag = ... }; ``` But doing that would mean the tag would be applied to any actions made using the Twinkle structure, such as addons like https://en.wikipedia.org/wiki/User:Bellezzasolo/Scripts/arb.js. Moreover, given the likely coincidence between 1. scripts using the morebits library, and 2. users of Twinkle, that would effectively make this a "morebits" tag rather than "twinkle." Having the invocation on a per module basis rather than `twinkle.js` only solves the issue if one and only one action is opened and then successfully performed, which is likewise unreliable. Instead, the structure used here means setting the tag manually and individually, using either the `tags` parameter for `Morebits.wiki.api` actions or `.setChangesTags` for `Morebits.wiki.page` (or by setting `this.changeTags` for `Morebits.userspacelogger`, done to avoid adding another parameter). Morebits (the library) maintains its ability to set its own tag for non-twinkle actions, although that might be undesirable and is turned off.
- Loading branch information
1 parent
2fcf267
commit c581923
Showing
3 changed files
with
67 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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