PageTriage has a list of enwiki maintenance tag templates and deletion templates both in the PageTriage codebase, and in a MediaWiki file onwiki. I have some concerns about this design.
- Duplicate code. Having to remember to change the tags list in two spots makes updates laborious, and these two places are prone to getting out of sync.
- The onwiki code does not get linted.
- Neither of these files is pure JSON. Currently there is JavaScript peppered in.
- One of these can overwrite pieces of the other without a warning.
I propose we do the following refactoring:
Patch 1
- copy paste the onwiki code into the repo, at the bottom of the appropriate file (confirmed that the load order is the repo file, then the wikitext) (gerrit:945002)
- wait for enwiki deploy
- blank the onwiki pages, to discourage future use
This gets all the code into one place which is a technical debt win. Easier development environment testing, easier to reason about it.
Patch 2
- refactor the files that received copy pastes, to eliminate code duplication
Patch 3
Patch 4
- T360885: Rename some PageTriage files
- at a minimum, rename defaultTagsOptions to defaultTagOptions, for grammar reasons. maybe choose a shorter name entirely
Patch 5
Patch 6
- T360886: Convert PageTriage options to json
- get rid of snapshot tests. won't need them if we are using pure json.
Unorganized
- decide if we want to stop translating all this very enwiki-specific stuff in the tags and deletion flyouts. For example, "pagetriage-del-tags-dbg10-desc": "Pages that disparage, threaten, intimidate or harass their subject or some other entity, and serve no other purpose. (G10)", This would involve substituting all the existing messages into the defaultTags.js files (gerrit:993244, T323882: Delete i18n pagetriage-tags- messages)
- get mw.msg to load in the Jest tests, so that snapshot tests are more accurate (right now they just pass along the msg name rather than loading the message) - can be done by modifying jest.setup.js, but may not want to. substituting the messages would also substitute the month names, which would make the snapshot break periodically
- we currently set 5 variables across 2 files. probably makes more sense to have 5 files or 1 file, rather than 2 files. decide which approach to do, then execute
- rename the config file to include something like "enwiki" or "englishWikipedia" in it. So if PageTriage is installed on other wikis, they can create their own file and give it a corresponding name.