Ask for confirmation when nuking

Bug: T131975
Change-Id: I908c1aacdc8069ea9ae1ec860eef5421d9da2fab
This commit is contained in:
Amir Sarabadani 2016-12-28 11:45:54 +03:30 committed by Amir Sarabadani
parent 50d948448e
commit 8bf771fc40
6 changed files with 30 additions and 3 deletions

View file

@ -1,6 +1,7 @@
{
"predef": [
"jQuery"
"jQuery",
"mediaWiki"
],
/* Common */

View file

@ -146,6 +146,8 @@ class SpecialNuke extends SpecialPage {
return;
}
$out->addModules( 'ext.nuke.confirm' );
if ( $username === '' ) {
$out->addWikiMsg( 'nuke-list-multiple' );
} else {

14
ext.nuke.confirm.js Normal file
View file

@ -0,0 +1,14 @@
( function ( mw, $ ) {
$( document ).ready( function () {
/*global confirm */
// Confirm nuke
$( 'form[name="nukelist"]' ).on( 'submit', function () {
var pages = $( this ).find( 'input[name="pages[]"][type="checkbox"]:checked' );
if ( pages.length ) {
return confirm( mw.msg( 'nuke-confirm', pages.length ).text() );
}
} );
} );
}( mediaWiki, jQuery ) );

View file

@ -30,6 +30,14 @@
"scripts": [
"ext.nuke.js"
]
},
"ext.nuke.confirm": {
"scripts": [
"ext.nuke.confirm.js"
],
"messages": [
"nuke-confirm"
]
}
},
"ResourceFileModulePaths": {

View file

@ -30,5 +30,6 @@
"nuke-viewchanges": "view changes",
"nuke-namespace": "Limit to namespace:",
"nuke-linkoncontribs": "mass delete",
"nuke-linkoncontribs-text": "Mass delete pages where {{GENDER:$1|this user}} is the only author"
"nuke-linkoncontribs-text": "Mass delete pages where {{GENDER:$1|this user}} is the only author",
"nuke-confirm": "You are about to delete {{PLURAL:$1|one page|$1 pages}}. Are you sure that you want to delete?"
}

View file

@ -41,5 +41,6 @@
"nuke-viewchanges": "Used as link text.\n\nThe link points to History page of the page.\n\nThis message follows:\n* {{msg-mw|nuke-editby}} and {{msg-mw|comma-separator}}\n* or empty string (if username is empty).\n{{Identical|View changes}}",
"nuke-namespace": "Label shown on [[Special:Nuke]] in front of the namespace input that allows choosing a namespace to filter the search by",
"nuke-linkoncontribs": "Used as link text which is used on [[Special:Contributions]] and [[Special:DeletedContributions]].\n\nOnly added if a user has rights to nuke pages.\n\nThe link has the tooltip {{msg-mw|Nuke-linkoncontribs-text}}.\n{{Identical|Mass delete}}",
"nuke-linkoncontribs-text": "Tooltip for the link which is labeled {{msg-mw|Nuke-linkoncontribs}} Parameters:\n* $1 is the target user name used for GENDER."
"nuke-linkoncontribs-text": "Tooltip for the link which is labeled {{msg-mw|Nuke-linkoncontribs}} Parameters:\n* $1 is the target user name used for GENDER.",
"nuke-confirm": "Message when the user is trying to delete pages."
}