Skip to content

Commit

Permalink
xfd: Don't show reason for AfD errors that don't matter
Browse files Browse the repository at this point in the history
Both delsort and pagetriage can lead to errors; the former mainly for nonexistent categories (rare), the latter for pages not in the triage queue (common, see #930).  None of these matter for the sake of losing the nomination reason, so neither needs to get evaluated before `Twinkle.xfd.currentRationale` is `null`ed.  Likely to be fairly common for the `triage` action.

If we handled `triage` the way initially proposed in #930, we wouldn't see these errors, so this is kind of kludgy.  Probably still worth it.
  • Loading branch information
Amorymeltzer committed Aug 7, 2020
1 parent db6732b commit 7a450cb
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions modules/twinklexfd.js
Original file line number Diff line number Diff line change
Expand Up @@ -917,12 +917,7 @@ Twinkle.xfd.callbacks = {

// Now we know we want to go ahead with it, trigger the other AJAX requests

// Mark the page as curated/patrolled, if wanted
if (Twinkle.getPref('markXfdPagesAsPatrolled')) {
pageobj.triage();
}

// Starting discussion page
// Start discussion page, will also handle pagetriage and delsort listings
var wikipedia_page = new Morebits.wiki.page(params.discussionpage, 'Creating article deletion discussion page');
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.afd.discussionPage);
Expand All @@ -945,16 +940,6 @@ Twinkle.xfd.callbacks = {
Twinkle.xfd.callbacks.addToLog(params, null);
}

// List at deletion sorting pages
if (params.delsortCats) {
params.delsortCats.forEach(function (cat) {
var delsortPage = new Morebits.wiki.page('Wikipedia:WikiProject Deletion sorting/' + cat, 'Adding to list of ' + cat + '-related deletion discussions');
delsortPage.setFollowRedirect(true); // In case a category gets renamed
delsortPage.setCallbackParameters({discussionPage: params.discussionpage});
delsortPage.load(Twinkle.xfd.callbacks.afd.delsortListing);
});
}

// Remove some tags that should always be removed on AfD.
text = text.replace(/\{\{\s*(dated prod|dated prod blp|Prod blp\/dated|Proposed deletion\/dated|prod2|Proposed deletion endorsed|Userspace draft)\s*(\|(?:\{\{[^{}]*\}\}|[^{}])*)?\}\}\s*/ig, '');
// Then, test if there are speedy deletion-related templates on the article.
Expand Down Expand Up @@ -985,6 +970,22 @@ Twinkle.xfd.callbacks = {
pageobj.setCreateOption('createonly');
pageobj.save(function() {
Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki

// Actions that should wait on the discussion page actually being created
// and whose errors shouldn't output the user rationale
// List at deletion sorting pages
if (params.delsortCats) {
params.delsortCats.forEach(function (cat) {
var delsortPage = new Morebits.wiki.page('Wikipedia:WikiProject Deletion sorting/' + cat, 'Adding to list of ' + cat + '-related deletion discussions');
delsortPage.setFollowRedirect(true); // In case a category gets renamed
delsortPage.setCallbackParameters({discussionPage: params.discussionpage});
delsortPage.load(Twinkle.xfd.callbacks.afd.delsortListing);
});
}
// Mark the page as curated/patrolled, if wanted
if (Twinkle.getPref('markXfdPagesAsPatrolled')) {
pageobj.triage();
}
});
},
todaysList: function(pageobj) {
Expand Down

0 comments on commit 7a450cb

Please sign in to comment.