Check titleblacklist
This commit is contained in:
parent
bb3906d0eb
commit
6c3b4b2e3b
@ -141,7 +141,8 @@
|
||||
// Load css
|
||||
mw.loader.load( AFCH.consts.scriptpath + '?action=raw&ctype=text/css&title=MediaWiki:Gadget-afch.css', 'text/css' );
|
||||
// Load dependencies
|
||||
mw.loader.load( [ 'mediawiki.feedback', 'mediawiki.api', 'mediawiki.api.category', 'jquery.chosen', 'jquery.spinner' ] );
|
||||
mw.loader.load( [ 'mediawiki.feedback', 'mediawiki.api', 'mediawiki.api.category', 'mediawiki.api.titleblacklist',
|
||||
'jquery.chosen', 'jquery.spinner' ] );
|
||||
}
|
||||
|
||||
// And finally load the subscript
|
||||
|
@ -1380,13 +1380,17 @@
|
||||
}
|
||||
page = new AFCH.Page( value );
|
||||
|
||||
AFCH.api.get( {
|
||||
action: 'query',
|
||||
prop: 'info',
|
||||
inprop: 'protection',
|
||||
titles: page.rawTitle
|
||||
} ).done( function ( data ) {
|
||||
$.when(
|
||||
AFCH.api.isBlacklisted( page ),
|
||||
AFCH.api.get( {
|
||||
action: 'query',
|
||||
prop: 'info',
|
||||
inprop: 'protection',
|
||||
titles: page.rawTitle
|
||||
} )
|
||||
).then( function ( isBlacklisted, rawData ) {
|
||||
var errorHtml, buttonText,
|
||||
data = rawData[0], // Get just the result, not the Promise object
|
||||
linkToPage = AFCH.jQueryToHtml( AFCH.makeLinkElementToPage( page.rawTitle ) );
|
||||
|
||||
// If the page already exists, display an error
|
||||
@ -1407,6 +1411,13 @@
|
||||
} );
|
||||
}
|
||||
|
||||
// Now check the blacklist result, but if another error already exists,
|
||||
// don't bother showing this one too
|
||||
if ( !errorHtml && isBlacklisted !== false ) {
|
||||
errorHtml = 'Shoot! ' + isBlacklisted.reason.replace( /\s+/g, ' ' );
|
||||
buttonText = 'The proposed title is blacklisted';
|
||||
}
|
||||
|
||||
if ( !errorHtml ) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user