Skip to content

Commit

Permalink
tag: fix pagetriagelist API undefined error (#1755)
Browse files Browse the repository at this point in the history
* fix merge conflict

* simplify

* ce
  • Loading branch information
NovemLinguae authored Jul 25, 2023
1 parent 379cb18 commit e035dff
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions modules/friendlytag.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ Twinkle.tag.callback = function friendlytagCallback() {
format: 'json',
page_id: mw.config.get('wgArticleId')
}).then(function(response) {
// figure out whether the article is marked as reviewed in PageTriage
var isReviewed = false;
var isOldPage = response.pagetriagelist.result !== 'success' || response.pagetriagelist.pages.length === 0;
var isMarkedAsReviewed = response.pagetriagelist.pages[0].patrol_status > 0;
if (isOldPage || isMarkedAsReviewed) {
isReviewed = true;
}
// Figure out whether the article is marked as reviewed in PageTriage.
// Recent articles will have a patrol_status that we can read.
// For articles that have been out of the new pages feed for awhile, pages[0] will be undefined.
var isReviewed = response.pagetriagelist.pages[0] ?
response.pagetriagelist.pages[0].patrol_status > 0 :
true;

// if article is not marked as reviewed, show the "mark as reviewed" check box
if (!isReviewed) {
Expand Down

0 comments on commit e035dff

Please sign in to comment.