MediaWiki:Gadget-twinkleblock.js: Difference between revisions

Content deleted Content added
Repo at 2c63365: Reorganize partial block templates into two headers
Repo at 712686d: Add Special:Unblock link in footer; upeblock to block options (#851); Use word boundary regex to match bot usernames; Disable CU/OS options unless user has the relevant perms
Line 18:
Twinkle.block = function twinkleblock() {
// should show on Contributions or Block pages, anywhere there's a relevant user
if (Morebits.userIsInGroup('sysop')userIsSysop && mw.config.get('wgRelevantUserName')) {
Twinkle.addPortletLink(Twinkle.block.callback, 'Block', 'tw-block', 'Block relevant user');
}
Line 28:
return;
}
 
Twinkle.block.currentBlockInfo = undefined;
Twinkle.block.field_block_options = {};
Twinkle.block.field_template_options = {};
 
var Window = new Morebits.simpleWindow(650, 530);
Line 36 ⟶ 40:
Window.addFooterLink('Block policy', 'WP:BLOCK');
Window.addFooterLink('Twinkle help', 'WP:TW/DOC#block');
 
Twinkle.block.currentBlockInfo = undefined;
Twinkle.block.field_block_options = {};
Twinkle.block.field_template_options = {};
 
var form = new Morebits.quickForm(Twinkle.block.callback.evaluate);
Line 86:
// clean up preset data (defaults, etc.), done exactly once, must be before Twinkle.block.callback.change_action is called
Twinkle.block.transformBlockPresets();
if (Twinkle.block.currentBlockInfo) {
Window.addFooterLink('Unblock this user', 'Special:Unblock/' + mw.config.get('wgRelevantUserName'), true);
}
 
// init the controls after user and block info have been fetched
Line 950 ⟶ 953:
reason: '{{uw-ublock-double}} <!-- Username closely resembles another user, hard block -->',
summary: 'You have been indefinitely blocked from editing because your [[WP:U|username]] appears to impersonate another established Wikipedia user'
},
'uw-upeblock': {
autoblock: true,
expiry: 'infinity',
forRegisteredOnly: true,
nocreate: true,
pageParam: true,
reason: '[[WP:PAID|Undisclosed paid editing]] in violation of the WMF [[WP:TOU|Terms of Use]]',
summary: 'You have been indefinitely blocked from editing because your account is being used in violation of [[WP:PAID|Wikipedia policy on undisclosed paid advocacy]]'
},
'uw-vaublock': {
Line 1,115 ⟶ 1,127:
{ label: 'Spam/advertising-only account', value: 'uw-soablock' },
{ label: 'Unapproved bot', value: 'uw-botblock' },
{ label: 'Undisclosed paid editing', value: 'uw-upeblock' },
{ label: 'Violating the three-revert rule', value: 'uw-3block' }
]
Line 1,137 ⟶ 1,150:
list: [
{ label: 'blocked proxy', value: 'blocked proxy' },
{ label: 'CheckUser block', value: 'CheckUser block', disabled: !Morebits.userIsInGroup('checkuser') },
{ label: 'checkuserblock-account', value: 'checkuserblock-account', disabled: !Morebits.userIsInGroup('checkuser') },
{ label: 'checkuserblock-wide', value: 'checkuserblock-wide', disabled: !Morebits.userIsInGroup('checkuser') },
{ label: 'colocationwebhost', value: 'colocationwebhost' },
{ label: 'oversightblock', value: 'oversightblock', disabled: !Morebits.userIsInGroup('oversight') },
// { label: 'rangeblock', value: 'rangeblock' }, // placeholder for when we add support for rangeblocks
{ label: 'spamblacklistblock', value: 'spamblacklistblock' },
Line 1,191 ⟶ 1,204:
value: templateName
}],
selected: !!blockPreset.selected,
disabled: !!blockPreset.disabled
};
}
Line 1,274 ⟶ 1,288:
 
// disable autoblock if blocking a bot
if (Twinkle.block.isRegistered && relevantUserName.search(/bot$\b/i) > 0) {
data.autoblock = false;
}