MediaWiki:Gadget-twinkleblock.js: Difference between revisions
Content deleted Content added
Repo at ac3c1e3: replace es-x/no-array-prototype-includes with unicorn/prefer-includes (#2125) |
MusikAnimal (talk | contribs) deploy #2180: soft redirect to Special:Block for multi-blocked targets |
||
Line 4:
const api = new mw.Api();
let relevantUserName, blockedUserName, blockWindow;
const menuFormattedNamespaces = $.extend({}, mw.config.get('wgFormattedNamespaces'));
menuFormattedNamespaces[0] = '(Article)';
Line 35:
Twinkle.block.field_template_options = {};
// need to be verbose about who we're blocking
// Always added, hidden later if actual user not blocked
const form = new Morebits.QuickForm(Twinkle.block.callback.evaluate);
Line 126:
const result = form.render();
result.root = result;
Line 155:
// Store fetched user data, only relevant if switching IPv6 to a /64
Twinkle.block.fetchedData = {};
// Processes the data from
// Twinkle.block.fetchUserInfo to allow reprocessing of already-fetched data
Twinkle.block.processUserInfo = function twinkleblockProcessUserInfo(data, fn) {
let blockinfo = data.query.blocks[0];
// Soft redirect to Special:Block if the user is multi-blocked (#2178)
if (blockinfo && data.query.blocks.length > 1) {
// Remove submission buttons.
$(blockWindow.content).dialog('widget').find('.morebits-dialog-buttons').empty();
Morebits.Status.init(blockWindow.content.querySelector('form'));
Morebits.Status.warn(
`This target has ${data.query.blocks.length} active blocks`,
`Multiblocks is not supported by Twinkle. Use [[Special:Block/${relevantUserName}]] instead.`
);
return;
}
const userinfo = data.query.users[0];
// If an IP is blocked *and* rangeblocked, the above finds
|