Skip to content

Commit

Permalink
Merge branch 'master' into eslint-config-wikimedia-2
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae authored Sep 6, 2024
2 parents d4f15ae + bdb69a0 commit 7f92399
Show file tree
Hide file tree
Showing 15 changed files with 146 additions and 136 deletions.
6 changes: 0 additions & 6 deletions .github/dependabot.yml

This file was deleted.

105 changes: 31 additions & 74 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -1,95 +1,52 @@
"Module: twinkle":
- changed-files:
- any-glob-to-any-file:
- twinkle.js
- twinkle.css
- twinkle-pagestyles.css
- twinkle.js
- twinkle.css
- twinkle-pagestyles.css
"Module: morebits":
- changed-files:
- any-glob-to-any-file:
- morebits.js
- morebits.css
- morebits.js
- morebits.css
"Module: arv":
- changed-files:
- any-glob-to-any-file:
- modules/twinklearv.js
- modules/twinklearv.js
"Module: batch":
- changed-files:
- any-glob-to-any-file:
- modules/twinklebatchdelete.js
- modules/twinklebatchundelete.js
- modules/twinklebatchprotect.js
- modules/twinkledeprod.js
- modules/twinklebatchdelete.js
- modules/twinklebatchundelete.js
- modules/twinklebatchprotect.js
- modules/twinkledeprod.js
"Module: block":
- changed-files:
- any-glob-to-any-file:
- modules/twinkleblock.js
- modules/twinkleblock.js
"Module: config":
- changed-files:
- any-glob-to-any-file:
- modules/twinkleconfig.js
- modules/twinkleconfig.js
"Module: diff":
- changed-files:
- any-glob-to-any-file:
- modules/twinklediff.js
- modules/twinklediff.js
"Module: fluff":
- changed-files:
- any-glob-to-any-file:
- modules/twinklefluff.js
- modules/twinklefluff.js
"Module: prod":
- changed-files:
- any-glob-to-any-file:
- modules/twinkleprod.js
- modules/twinkleprod.js
"Module: protect":
- changed-files:
- any-glob-to-any-file:
- modules/twinkleprotect.js
- modules/twinkleprotect.js
"Module: speedy":
- changed-files:
- any-glob-to-any-file:
- modules/twinklespeedy.js
- modules/twinkleimage.js
- modules/twinklespeedy.js
- modules/twinkleimage.js
"Module: tag":
- changed-files:
- any-glob-to-any-file:
- modules/friendlytag.js
- modules/friendlytag.js
"Module: talkback":
- changed-files:
- any-glob-to-any-file:
- modules/friendlytalkback.js
- modules/friendlytalkback.js
"Module: unlink":
- changed-files:
- any-glob-to-any-file:
- modules/twinkleunlink.js
- modules/twinkleunlink.js
"Module: warn":
- changed-files:
- any-glob-to-any-file:
- modules/twinklewarn.js
- modules/twinklewarn.js
"Module: welcome":
- changed-files:
- any-glob-to-any-file:
- modules/friendlywelcome.js
- modules/friendlywelcome.js
"Module: xfd":
- changed-files:
- any-glob-to-any-file:
- modules/twinklexfd.js
- modules/twinklexfd.js
Tests:
- changed-files:
- any-glob-to-any-file:
- tests/*
- scripts/patch-test.js
- scripts/server.js
- ".github/*"
- tests/*
- scripts/patch-test.js
- scripts/server.js
Docs:
- changed-files:
- any-glob-to-any-file:
- "*.md"
- "*.md"
Gadget:
- changed-files:
- any-glob-to-any-file:
- gadget.txt
- gadget.txt
dependencies:
- changed-files:
- any-glob-to-any-file:
- package.json
- package-lock.json
- package.json
- package-lock.json
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -45,7 +45,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -59,4 +59,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@main
- uses: actions/labeler@v4
with:
configuration-path: ".github/labels.yml"
repo-token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
5 changes: 3 additions & 2 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,12 @@ Every time:

### Dependencies

All the dependencies that Twinkle uses are JavaScript **dev** dependencies. They are not used at all on-wiki and are just used during development. Here's what they are and what they do. This may help with evaluating dependabot patches (dependabot is a GitHub bot that helps keep libraries up to date by submitting pull requests).
All the dependencies that Twinkle uses are JavaScript **dev** dependencies. They are not used at all on-wiki and are just used during development. Here's what they are and what they do.

- eslint - Used by continuous integration for enforcing code linting rules.
- jest - Used by continuous integration for unit testing.
- jest-environment-jsdom - Needed for Jest to work.
- mock-mediawiki - Used by continuous integration for unit testing.
- mwn - Used when you run `npm start`. `npm start` is what enables localhost testing.
- Everything else - Dependabot will not usually try to update these unless one of the 5 above dependencies gets out of date. It is probably best to update the above dependencies instead.

When updating dependencies, CI should take care of testing most of that. Manually testing `npm start` should be the only additional check needed.
21 changes: 13 additions & 8 deletions modules/friendlytag.js
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,9 @@ Twinkle.tag.article.tagList = {
{ tag: 'Essay-like', description: 'written like a personal reflection, personal essay, or argumentative essay' },
{ tag: 'Fanpov', description: "written from a fan's point of view" },
{ tag: 'Inappropriate person', description: 'uses first-person or second-person inappropiately' },
{ tag: 'Like resume', description: 'written like a resume' },
{ tag: 'Resume-like', description: 'written like a resume' },
{ tag: 'Manual', description: 'written like a manual or guidebook' },
{ tag: 'Cleanup-PR', description: 'reads like a press release or news article',
{ tag: 'Cleanup press release', description: 'reads like a press release or news article',
subgroup: {
type: 'hidden',
name: 'cleanupPR1',
Expand Down Expand Up @@ -832,9 +832,12 @@ Twinkle.tag.article.tagList = {
{ tag: 'Weasel', description: 'neutrality or verifiability is compromised by the use of weasel words' }
],
'Verifiability and sources': [
{ tag: 'BLP sources', description: 'BLP that needs additional sources for verification' },
{ tag: 'BLP unsourced', description: 'BLP that has no sources at all (use BLP PROD instead for new articles)' },
{ tag: 'BLP one source', description: 'BLP that relies largely or entirely on a single source' },
{ tag: 'BLP sources', description: 'BLP that needs additional references or sources for verification' },
{ tag: 'BLP unreferenced', description: 'BLP does not cite any sources at all (use BLP PROD instead for new articles)' },
{ tag: 'More citations needed', description: 'needs additional references or sources for verification' },
{ tag: 'No significant coverage', description: 'does not cite any sources containing significant coverage' },
{ tag: 'No significant coverage (sports)', description: 'sports biography that does not cite any sources containing significant coverage' },
{ tag: 'One source', description: 'relies largely or entirely on a single source' },
{ tag: 'Original research', description: 'contains original research' },
{ tag: 'Primary sources', description: 'relies too much on references to primary sources, and needs secondary sources' },
Expand Down Expand Up @@ -1441,13 +1444,15 @@ Twinkle.tag.callbacks = {

var text, summary;
if (params.tags.indexOf('Rough translation') !== -1) {
templateText = '{{subst:duflu|pg=' + Morebits.pageNameNorm + '|Language=' +
templateText = '{{subst:Dual fluency request|pg=' + Morebits.pageNameNorm + '|Language=' +
(lang || 'uncertain') + '|Comments=' + reason.trim() + '}} ~~~~';
// Place in section == Translated pages that could still use some cleanup ==
text = old_text + '\n\n' + templateText;
summary = 'Translation cleanup requested on ';
} else {
templateText = '{{subst:needtrans|pg=' + Morebits.pageNameNorm + '|Language=' +
} else if (params.tags.indexOf('Not English') !== -1) {
templateText = '{{subst:Translation request|pg=' + Morebits.pageNameNorm + '|Language=' +
(lang || 'uncertain') + '|Comments=' + reason.trim() + '}} ~~~~';
// Place in section == Pages for consideration ==
text = old_text.replace(/\n+(==\s?Translated pages that could still use some cleanup\s?==)/,
'\n\n' + templateText + '\n\n$1');
summary = 'Translation' + (lang ? ' from ' + lang : '') + ' requested on ';
Expand Down Expand Up @@ -1543,7 +1548,7 @@ Twinkle.tag.callbacks = {
});
pages.forEach(function(page) {
var removed = false;
page.linkshere.forEach(function(el) {
page.linkshere.concat({title: page.title}).forEach(function(el) {
var tag = el.title.slice(9);
var tag_re = new RegExp('\\{\\{' + Morebits.pageNameRegex(tag) + '\\s*(\\|[^}]*)?\\}\\}\\n?');
if (tag_re.test(pageText)) {
Expand Down
63 changes: 42 additions & 21 deletions modules/friendlywelcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Twinkle.welcome.callback = function friendlywelcomeCallback(uid) {
event: Twinkle.welcome.populateWelcomeList,
list: [
{ type: 'option', value: 'standard', label: 'Standard welcomes', selected: !mw.util.isIPAddress(mw.config.get('wgRelevantUserName')) },
{ type: 'option', value: 'anonymous', label: 'IP user welcomes', selected: mw.util.isIPAddress(mw.config.get('wgRelevantUserName')) },
{ type: 'option', value: 'unregistered', label: 'IP user welcomes', selected: mw.util.isIPAddress(mw.config.get('wgRelevantUserName')) },
{ type: 'option', value: 'wikiProject', label: 'WikiProject welcomes' },
{ type: 'option', value: 'nonEnglish', label: 'Non-English welcomes' }
]
Expand Down Expand Up @@ -183,7 +183,7 @@ Twinkle.welcome.populateWelcomeList = function(e) {

var container = new Morebits.quickForm.element({ type: 'fragment' });

if ((type === 'standard' || type === 'anonymous') && Twinkle.getPref('customWelcomeList').length) {
if ((type === 'standard' || type === 'unregistered') && Twinkle.getPref('customWelcomeList').length) {
container.append({ type: 'header', label: 'Custom welcome templates' });
container.append({
type: 'radio',
Expand Down Expand Up @@ -275,6 +275,10 @@ Twinkle.welcome.templates = {
'welcome non-latin': {
description: 'welcome for users with a username containing non-Latin characters',
syntax: '{{subst:welcome non-latin|$USERNAME$}} ~~~~'
},
'welcome mentor': {
description: 'welcome for mentor users to give to their mentees',
syntax: '{{subst:mentor welcome|$USERNAME$}} ~~~~'
}
},

Expand Down Expand Up @@ -341,37 +345,42 @@ Twinkle.welcome.templates = {
}
},

anonymous: {
'Anonymous user welcome templates': {
'welcome-anon': {
description: 'for anonymous users; encourages creating an account',
unregistered: {
'Unregistered user welcome templates': {
'welcome-unregistered': {
description: 'for unregistered users; encourages creating an account',
linkedArticle: true,
syntax: '{{subst:welcome-anon|art=$ARTICLE$}} ~~~~'
syntax: '{{subst:welcome-unregistered|art=$ARTICLE$}} ~~~~'
},
'thanks': {
description: 'for anonymous users; short; encourages creating an account',
description: 'for unregistered users; short; encourages creating an account',
linkedArticle: true,
syntax: '== Welcome! ==\n{{subst:thanks|page=$ARTICLE$}} ~~~~'
},
'welcome-anon-test': {
description: 'for anonymous users who have performed test edits',
'welcome-unregistered-test': {
description: 'for unregistered users who have performed test edits',
linkedArticle: true,
syntax: '{{subst:welcome-unregistered-test|$ARTICLE$|$USERNAME$}} ~~~~'
},
'welcome-unregistered-unconstructive': {
description: 'for unregistered users who have vandalized or made unhelpful edits',
linkedArticle: true,
syntax: '{{subst:welcome-anon-test|$ARTICLE$|$USERNAME$}} ~~~~'
syntax: '{{subst:welcome-unregistered-unconstructive|$ARTICLE$|$USERNAME$}}'
},
'welcome-anon-unconstructive': {
description: 'for anonymous users who have vandalized or made unhelpful edits',
'welcome-unregistered-constructive': {
description: 'for unregistered users who fight vandalism or edit constructively',
linkedArticle: true,
syntax: '{{subst:welcome-anon-unconstructive|$ARTICLE$|$USERNAME$}}'
syntax: '{{subst:welcome-unregistered-constructive|art=$ARTICLE$}}'
},
'welcome-anon-constructive': {
description: 'for anonymous users who fight vandalism or edit constructively',
'welcome-unregistered-delete': {
description: 'for unregistered users who have removed content from pages',
linkedArticle: true,
syntax: '{{subst:welcome-anon-constructive|art=$ARTICLE$}}'
syntax: '{{subst:welcome-unregistered-delete|$ARTICLE$|$USERNAME$}} ~~~~'
},
'welcome-anon-delete': {
description: 'for anonymous users who have removed content from pages',
'welcome-unregistered-unsourced': {
description: 'for anonymous users who have added unsourced content',
linkedArticle: true,
syntax: '{{subst:welcome-anon-delete|$ARTICLE$|$USERNAME$}} ~~~~'
syntax: '{{subst:welcome-unregistered-unsourced|$ARTICLE$|$USERNAME$}}'
}
}
},
Expand Down Expand Up @@ -490,7 +499,7 @@ Twinkle.welcome.templates = {
syntax: '{{subst:welcome-videogames}}'
},
'WikiProject Women in Red invite': {
description: 'welcome for users with an intrest in writing about women',
description: 'welcome for users with an interest in writing about women',
syntax: '{{subst:WikiProject Women in Red invite|1=~~~~}}'
}
}
Expand Down Expand Up @@ -534,6 +543,18 @@ Twinkle.welcome.templates = {
description: 'welcome for users whose first language appears to be Hebrew',
syntax: '{{subst:welcomeen-he}}'
},
'welcomeen-hi': {
description: 'welcome for users whose first language appears to be Hindi',
syntax: '{{subst:welcomeen-hi}}'
},
'welcomeen-id': {
description: 'welcome for users whose first language appears to be Indonesian',
syntax: '{{subst:welcomeen-id}}'
},
'welcomeen-it': {
description: 'welcome for users whose first language appears to be Italian',
syntax: '{{subst:welcomeen-it}}'
},
'welcomeen-ja': {
description: 'welcome for users whose first language appears to be Japanese',
syntax: '{{subst:welcomeen-ja}}'
Expand Down
3 changes: 2 additions & 1 deletion modules/twinklearv.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ Twinkle.arv.callback.evaluate = function(e) {
// Report inappropriate username
case 'username':
types = form.getChecked('arvtype').map(Morebits.string.toLowerCaseFirstChar);
var censorUsername = types.includes('offensive'); // check if the username is marked offensive

// generate human-readable string, e.g. "misleading and promotional username"
if (types.length <= 2) {
Expand Down Expand Up @@ -640,7 +641,7 @@ Twinkle.arv.callback.evaluate = function(e) {
return;
}
uaaPage.getStatusElement().status('Adding new report...');
uaaPage.setEditSummary('Reporting [[Special:Contributions/' + uid + '|' + uid + ']].');
uaaPage.setEditSummary('Reporting ' + (censorUsername ? 'an offensive username.' : '[[Special:Contributions/' + uid + '|' + uid + ']].'));
uaaPage.setChangeTags(Twinkle.changeTags);

// Blank newline per [[Special:Permalink/996949310#Spacing]]; see also [[WP:LISTGAP]] and [[WP:INDENTGAP]]
Expand Down
Loading

0 comments on commit 7f92399

Please sign in to comment.