Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent placing of protection, XFD, or CSD tags on TimedText pages #2027

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions modules/twinkleprotect.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Twinkle.protect.callback = function twinkleprotectCallback() {
label: 'Tag page with protection template',
value: 'tag',
tooltip: 'If the protecting admin forgot to apply a protection template, or you have just protected the page without tagging, you can use this to apply the appropriate protection tag.',
disabled: mw.config.get('wgArticleId') === 0 || mw.config.get('wgPageContentModel') === 'Scribunto'
disabled: mw.config.get('wgArticleId') === 0 || mw.config.get('wgPageContentModel') === 'Scribunto' || mw.config.get('wgNamespaceNumber') === 710 // TimedText
}
]
});
Expand Down Expand Up @@ -502,7 +502,7 @@ Twinkle.protect.callback.changeAction = function twinkleprotectCallbackChangeAct
value: '',
tooltip: 'Optional revision ID of the RfPP page where protection was requested.'
});
if (!mw.config.get('wgArticleId') || mw.config.get('wgPageContentModel') === 'Scribunto') { // tagging isn't relevant for non-existing or module pages
if (!mw.config.get('wgArticleId') || mw.config.get('wgPageContentModel') === 'Scribunto' || mw.config.get('wgNamespaceNumber') === 710) { // tagging isn't relevant for non-existing, module, or TimedText pages
break;
}
/* falls through */
Expand Down Expand Up @@ -1075,8 +1075,8 @@ Twinkle.protect.callback.changePreset = function twinkleprotectCallbackChangePre
// Add any annotations
Twinkle.protect.callback.annotateProtectReason(e);

// sort out tagging options, disabled if nonexistent or lua
if (mw.config.get('wgArticleId') && mw.config.get('wgPageContentModel') !== 'Scribunto') {
// sort out tagging options, disabled if nonexistent, lua, or TimedText
if (mw.config.get('wgArticleId') && mw.config.get('wgPageContentModel') !== 'Scribunto' && mw.config.get('wgNamespaceNumber') !== 710) {
if (form.category.value === 'unprotect') {
form.tagtype.value = 'none';
} else {
Expand Down Expand Up @@ -1112,7 +1112,7 @@ Twinkle.protect.callback.evaluate = function twinkleprotectCallbackEvaluate(e) {
var input = Morebits.quickForm.getInputData(form);

var tagparams;
if (input.actiontype === 'tag' || (input.actiontype === 'protect' && mw.config.get('wgArticleId') && mw.config.get('wgPageContentModel') !== 'Scribunto')) {
if (input.actiontype === 'tag' || (input.actiontype === 'protect' && mw.config.get('wgArticleId') && mw.config.get('wgPageContentModel') !== 'Scribunto' && mw.config.get('wgNamespaceNumber') !== 710 /* TimedText */)) {
tagparams = {
tag: input.tagtype,
reason: false,
Expand Down
4 changes: 2 additions & 2 deletions modules/twinklespeedy.js
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ Twinkle.speedy.callbacks = {
}

// Tag if possible, post on talk if not
if (pageobj.canEdit() && ['wikitext', 'Scribunto', 'javascript', 'css', 'sanitized-css'].indexOf(pageobj.getContentModel()) !== -1) {
if (pageobj.canEdit() && ['wikitext', 'Scribunto', 'javascript', 'css', 'sanitized-css'].indexOf(pageobj.getContentModel()) !== -1 && mw.config.get('wgNamespaceNumber') !== 710 /* TimedText */) {
var text = pageobj.getPageText();

statelem.status('Checking for tags on the page...');
Expand Down Expand Up @@ -1483,7 +1483,7 @@ Twinkle.speedy.callbacks = {
talk_page.setCallbackParameters(params);
talk_page.newSection(Twinkle.speedy.callbacks.user.tagComplete);
} else {
pageobj.getStatusElement().error('Page protected and nowhere to add an edit request, aborting');
pageobj.getStatusElement().error('Page cannot be edited and no other location to place a speedy deletion request, aborting');
}
}
},
Expand Down
36 changes: 21 additions & 15 deletions modules/twinklexfd.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,17 +499,19 @@ Twinkle.xfd.callback.change_category = function twinklexfdCallbackChangeCategory
label: 'Miscellany for deletion',
name: 'work_area'
});
work_area.append({
type: 'checkbox',
list: [
{
label: 'Wrap deletion tag with <noinclude>',
value: 'noinclude',
name: 'noinclude',
tooltip: 'Will wrap the deletion tag in <noinclude> tags, so that it won\'t transclude. Select this option for userboxes.'
}
]
});
if (mw.config.get('wgNamespaceNumber') !== 710) { // TimedText cannot be tagged, so asking whether to noinclude the tag is pointless
work_area.append({
type: 'checkbox',
list: [
{
label: 'Wrap deletion tag with <noinclude>',
value: 'noinclude',
name: 'noinclude',
tooltip: 'Will wrap the deletion tag in <noinclude> tags, so that it won\'t transclude. Select this option for userboxes.'
}
]
});
}
if ((mw.config.get('wgNamespaceNumber') === 2 /* User: */ || mw.config.get('wgNamespaceNumber') === 3 /* User talk: */) && mw.config.exists('wgRelevantUserName')) {
work_area.append({
type: 'checkbox',
Expand Down Expand Up @@ -1499,11 +1501,15 @@ Twinkle.xfd.callbacks = {

apiobj.statelem.info('next in order is [[' + apiobj.params.discussionpage + ']]');

var wikipedia_page;

// Tagging page
var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Tagging page with deletion tag');
wikipedia_page.setFollowRedirect(true); // should never be needed, but if the page is moved, we would want to follow the redirect
wikipedia_page.setCallbackParameters(apiobj.params);
wikipedia_page.load(Twinkle.xfd.callbacks.mfd.taggingPage);
if (mw.config.get('wgNamespaceNumber') !== 710) { // cannot tag TimedText pages
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Tagging page with deletion tag');
wikipedia_page.setFollowRedirect(true); // should never be needed, but if the page is moved, we would want to follow the redirect
wikipedia_page.setCallbackParameters(apiobj.params);
wikipedia_page.load(Twinkle.xfd.callbacks.mfd.taggingPage);
}

// Updating data for the action completed event
Morebits.wiki.actionCompleted.redirect = apiobj.params.discussionpage;
Expand Down
Loading