Skip to content

Commit

Permalink
Block: Tweak reblock message when user is partially blocked
Browse files Browse the repository at this point in the history
This merely notes whether a user is partially blocked or sitewide blocked in the red message to sysops.  Also notes in a few minor places that the module is for sitewide blocks (wikimedia-gadgets#802).

A query to `list: 'blocks'` without any `bkprop`s defined (as we have here) apparently returns `partial: ''` if the user is partially blocked, and nothing if they're not, so relies on that.
  • Loading branch information
Amorymeltzer committed Jan 13, 2020
1 parent 87ead89 commit 60c19e5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions modules/twinkleblock.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var api = new mw.Api(), relevantUserName;
Twinkle.block = function twinkleblock() {
// should show on Contributions or Block pages, anywhere there's a relevant user
if (Morebits.userIsInGroup('sysop') && mw.config.get('wgRelevantUserName')) {
Twinkle.addPortletLink(Twinkle.block.callback, 'Block', 'tw-block', 'Block relevant user');
Twinkle.addPortletLink(Twinkle.block.callback, 'Block', 'tw-block', 'Block relevant user sitewide');
}
};

Expand Down Expand Up @@ -51,7 +51,7 @@ Twinkle.block.callback = function twinkleblockCallback() {
{
label: 'Block user',
value: 'block',
tooltip: 'Block the relevant user with given options.',
tooltip: 'Block the relevant user sitewide with given options.',
checked: true
},
{
Expand Down Expand Up @@ -378,7 +378,11 @@ Twinkle.block.callback.change_action = function twinkleblockCallbackChangeAction

if (Twinkle.block.currentBlockInfo) {
Morebits.status.init($('div[name="currentblock"] span').last()[0]);
Morebits.status.warn(relevantUserName + ' is already blocked', 'Submit query to reblock with supplied options');
if (Twinkle.block.currentBlockInfo.partial === '') { // Partial block
Morebits.status.warn(relevantUserName + ' is partially blocked', 'Submit query to convert to a sitewide block with supplied options');
} else if (Twinkle.block.currentBlockInfo.partial === undefined) { // Sitewide block
Morebits.status.warn(relevantUserName + ' is already blocked', 'Submit query to reblock with supplied options');
}
Twinkle.block.callback.update_form(e, Twinkle.block.currentBlockInfo);
} else if ($form.find('[name=actiontype][value=template]').is(':checked')) {
// make sure all the fields are correct based on defaults
Expand Down

0 comments on commit 60c19e5

Please sign in to comment.