MediaWiki:Gadget-twinkleblock.js: Difference between revisions
Content deleted Content added
Amorymeltzer (talk | contribs) Repo at 3c65fa5b: Add isInfinity for whether MW will parse string as infinite, use in block |
Amorymeltzer (talk | contribs) Repo at 10b4f79c: Prevent infinite blocks of IP addresses; add uw-botuhblock (#1089); Don't confirm no restrictions if email harassment is selected |
||
Line 774:
reason: '{{uw-botublock}} <!-- Username implies a bot, soft block -->',
summary: 'You have been indefinitely blocked from editing because your [[WP:U|username]] indicates this is a [[WP:BOT|bot]] account, which is currently not approved'
},
'uw-botuhblock': {
autoblock: true,
expiry: 'infinity',
forRegisteredOnly: true,
nocreate: true,
reason: '{{uw-botuhblock}} <!-- Username implies a bot, hard block -->',
summary: 'You have been indefinitely blocked from editing because your username is a blatant violation of the [[WP:U|username policy]].'
},
'uw-causeblock': {
Line 1,147 ⟶ 1,155:
label: 'Username violations',
list: [
{ label: 'Bot username, soft block', value: 'uw-botublock' },
{ label: 'Bot username, hard block', value: 'uw-botuhblock' },
{ label: 'Promotional username, hard block', value: 'uw-spamublock' },
{ label: 'Promotional username, soft block', value: 'uw-softerblock' },
Line 1,422 ⟶ 1,431:
if (!blockoptions.noemail && !blockoptions.nocreate) { // Blank entries technically allowed [[phab:T208645]]
return alert('No pages or namespaces were selected, nor were email or account creation restrictions applied; please select at least one option to apply a partial block!');
} else if ((templateoptions.template !== 'uw-epblock' || $form.find('select[name="preset"]').val() !== 'uw-epblock') &&
} else if (!confirm('You are about to block with no restrictions on page or namespace editing, are you sure you want to proceed?')) {▼
// Don't require confirmation if email harassment defaults are set
▲
return;
}
Line 1,429 ⟶ 1,440:
if (!blockoptions.expiry) {
return alert('Please provide an expiry!');
} else if (Morebits.string.isInfinity(blockoptions.expiry) && !Twinkle.block.isRegistered) {
return alert("Can't indefinitely block an IP address!");
}
if (!blockoptions.reason) {
Line 1,511 ⟶ 1,524:
blockoptions.reblock = 1; // Writing over a block will fail otherwise
}
// execute block
blockoptions.tags = Twinkle.changeTags;
blockoptions.token = mw.user.tokens.get('csrfToken');
var mbApi = new Morebits.wiki.api('Executing block', blockoptions, function() {
Line 1,663 ⟶ 1,678:
summary += ' on [[:' + params.article + ']]';
}
summary += '.'
pageobj.setPageText(text);
pageobj.setEditSummary(summary);
pageobj.setChangeTags(Twinkle.changeTags);
pageobj.setWatchlist(Twinkle.getPref('watchWarnings'));
pageobj.save();
|