Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag: fix pagetriagelist API undefined error #1755

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading