Skip to content

Commit

Permalink
Merge pull request #458 from siddharthvp/prodblpcheck
Browse files Browse the repository at this point in the history
prod: add alert if BLPPROD is applied but article is not in Category:Living people
  • Loading branch information
Amorymeltzer committed Dec 11, 2018
2 parents b9a21c4 + 02a9b06 commit 69e5eb2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/twinkleprod.js
Expand Up @@ -177,12 +177,23 @@ Twinkle.prod.callbacks = {
var text = pageobj.getPageText();
var params = pageobj.getCallbackParameters();

// Check for already existing deletion tags
var tag_re = /({{(?:db-?|delete|[aitcmrs]fd|md1)[^{}]*?\|?[^{}]*?}})/i;
if( tag_re.test( text ) ) {
statelem.warn( 'Page already tagged with a deletion template, aborting procedure' );
return;
}

// Alert if article is not in Category:Living people and BLPPROD is selected
if( params.blp ) {
var blpcheck_re = /\[\[Category:Living people\]\]/i;
if( !blpcheck_re.test( text ) ) {
if( ! confirm("Please note that the article is not in Category:Living people and hence may be ineligible for BLPPROD. Are you sure you want to continue? \n\nYou may wish to add the category if you proceed, unless the article is about a recently deceased person." ) ) {
return;
}
}
}

// Remove tags that become superfluous with this action
text = text.replace(/{{\s*(userspace draft|mtc|(copy|move) to wikimedia commons|(copy |move )?to ?commons)\s*(\|(?:{{[^{}]*}}|[^{}])*)?}}\s*/gi, "");
var prod_re = /{{\s*(?:dated prod|dated files|dated prod blp|Prod blp\/dated|Proposed deletion\/dated)\s*\|(?:{{[^{}]*}}|[^{}])*}}/i;
Expand Down

0 comments on commit 69e5eb2

Please sign in to comment.