MediaWiki:Gadget-UserRightsManager.js: Difference between revisions
From Test Wiki
Content deleted Content added
clean out code for updating markadmins.json since it's no longer necessary due to gadget changes |
m Reverted edits by Justarandomamerican (talk) to last revision by Tsukushi Tag: Rollback |
||
(21 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
// <nowiki> |
// <nowiki> |
||
// Adapted from [[mhtest:MediaWiki:Gadget-userRightsManagerTW.js]], itself adapted from [[w:User:MusikAnimal/userRightsManager.js]] |
// Adapted from [[mhtest:MediaWiki:Gadget-userRightsManagerTW.js]], itself adapted from [[w:User:MusikAnimal/userRightsManager.js]], this code is therefore licensed under CC-BY-SA 4.0 |
||
(function() { |
(function() { |
||
if (mw.config.get('wgPageName') != 'Test_Wiki: |
if (mw.config.get('wgPageName') != 'Test_Wiki:Request_for_permissions' && !mw.config.get('wgPageName').includes('URMTW-TESTPAGE-RFP')) { |
||
return; |
return; |
||
} |
} |
||
Line 9: | Line 9: | ||
'sysop': 'Administrator', |
'sysop': 'Administrator', |
||
'bureaucrat': 'Bureaucrat', |
'bureaucrat': 'Bureaucrat', |
||
'interface-admin': 'Interface |
'interface-admin': 'Interface administrator', |
||
'non-stewardsuppress': 'Suppressor', |
|||
'abusefilter-admin': 'Abuse filter administrator', |
|||
} |
} |
||
var cannedResponses = { |
var cannedResponses = { |
||
'sysop': '{{ |
'sysop': '{{administrator granted}} ~~~~', |
||
'bureaucrat': '{{ |
'bureaucrat': '{{bureaucrat granted}} ~~~~', |
||
'interface-admin': '{{ |
'interface-admin': '{{interface administrator granted}} ~~~~', |
||
'non-stewardsuppress': '{{done}}. ~~~~', |
|||
'abusefilter-admin': '{{done}}. ~~~~', |
|||
}; |
}; |
||
Line 69: | Line 73: | ||
this.groupsInterfaceAdminInput = new OO.ui.CheckboxInputWidget({ |
this.groupsInterfaceAdminInput = new OO.ui.CheckboxInputWidget({ |
||
selected: permissionText.includes('interface') && mw.config.get('wgUserGroups').includes('steward'), |
selected: permissionText.includes('interface') && mw.config.get('wgUserGroups').includes('steward'), |
||
disabled: !mw.config.get('wgUserGroups').includes('steward') |
|||
}); |
|||
this.groupsNonStewardSuppressInput = new OO.ui.CheckboxInputWidget({ |
|||
selected: permissionText.includes('suppress') && mw.config.get('wgUserGroups').includes('steward'), |
|||
disabled: !mw.config.get('wgUserGroups').includes('steward') |
|||
}); |
|||
this.groupsAbuseFilterInput = new OO.ui.CheckboxInputWidget({ |
|||
selected: permissionText.includes('abusefilter-admin') && mw.config.get('wgUserGroups').includes('steward'), |
|||
disabled: !mw.config.get('wgUserGroups').includes('steward') |
disabled: !mw.config.get('wgUserGroups').includes('steward') |
||
}); |
}); |
||
Line 86: | Line 98: | ||
new OO.ui.FieldLayout(this.groupsBureaucratInput, {label: 'Bureaucrat', align: 'inline'}), |
new OO.ui.FieldLayout(this.groupsBureaucratInput, {label: 'Bureaucrat', align: 'inline'}), |
||
new OO.ui.FieldLayout(this.groupsInterfaceAdminInput, {label: 'Interface administrator', align: 'inline'}), |
new OO.ui.FieldLayout(this.groupsInterfaceAdminInput, {label: 'Interface administrator', align: 'inline'}), |
||
new OO.ui.FieldLayout(this.groupsNonStewardSuppressInput, {label: 'Suppressor', align: 'inline'}), |
|||
new OO.ui.FieldLayout(this.groupsAbuseFilterInput, {label: 'Abuse filter administrator', align: 'inline'}), |
|||
] |
] |
||
}) |
}) |
||
Line 125: | Line 139: | ||
if(this.groupsBureaucratInput.isSelected()) perms.push('bureaucrat'); |
if(this.groupsBureaucratInput.isSelected()) perms.push('bureaucrat'); |
||
if(this.groupsInterfaceAdminInput.isSelected()) perms.push('interface-admin'); |
if(this.groupsInterfaceAdminInput.isSelected()) perms.push('interface-admin'); |
||
if(this.groupsNonStewardSuppressInput.isSelected()) perms.push('non-stewardsuppress'); |
|||
if(this.groupsNonStewardSuppressInput.isSelected()) perms.push('abusefilter-admin'); |
|||
var self = this, promiseCount = |
var self = this, promiseCount = 2; |
||
self.actions.setAbilities( { submit: false } ); |
self.actions.setAbilities( { submit: false } ); |
||
Line 208: | Line 224: | ||
user: userName.replace(/ /g, '_'), |
user: userName.replace(/ /g, '_'), |
||
add: perms.join('|'), |
add: perms.join('|'), |
||
reason: '+' + perms.join(', +') + '; ' + permaLink + ' at [[TW: |
reason: '+' + perms.join(', +') + '; ' + permaLink + ' at [[TW:RfP]]', |
||
expiry: 'infinity', |
expiry: 'infinity', |
||
tags: ' |
tags: 'userRightsManager' |
||
}); |
}); |
||
} |
} |
||
Line 230: | Line 246: | ||
'section': sectionId, |
'section': sectionId, |
||
'text': newContent, |
'text': newContent, |
||
'tags': ' |
'tags': 'userRightsManager', |
||
summary: '/* User:' + userName + ' */ done' |
summary: '/* User:' + userName + ' */ done' |
||
}) |
}) |