Skip to content

Commit

Permalink
Merge e77f46a into bf9139d
Browse files Browse the repository at this point in the history
  • Loading branch information
Pchelolo committed Jun 12, 2018
2 parents bf9139d + e77f46a commit d27f4f8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
23 changes: 21 additions & 2 deletions sys/page_revisions.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class PRS {
getTableSchema() {
return {
table: tableName,
version: 1,
version: 2,
attributes: {
title: 'string',
page_id: 'int',
Expand All @@ -61,7 +61,8 @@ class PRS {
timestamp: 'timestamp',
comment: 'string',
redirect: 'boolean',
page_deleted: 'int'
page_deleted: 'int',
page_language: 'string'
},
index: [
{ attribute: 'title', type: 'hash' },
Expand Down Expand Up @@ -360,6 +361,23 @@ class PRS {
}
return revisionRequest
.then((res) => {
// TODO: temprorary code to ensure all revision responces
// have the pagelanguage property set.
if (res.body.items.length && !res.body.items[0].page_language) {
if (mwUtil.isNoCacheRequest(req)) {
hyper.logger.log('error/pagelanguage', {
msg: 'Failed to fetch pagelanguage',
page_title: rp.title,
page_revision: rp.revision
});
} else {
req.headers = req.headers || {};
req.headers['cache-control'] = 'no-cache';
return this.getTitleRevision(hyper, req);
}
}
// End of temporary code

// Check if the revision has any restrictions
this._checkRevReturn(res.body.items.length && res.body.items[0]);

Expand Down Expand Up @@ -584,6 +602,7 @@ class PRS {
comment: restrictions.indexOf('commenthidden') < 0 ? apiRev.comment : null,
tags: apiRev.tags,
restrictions,
page_language: dataResp.pagelanguage,
// Get the redirect property, it's inclusion means true
// FIXME: Figure out redirect strategy: https://phabricator.wikimedia.org/T87393
redirect: dataResp.redirect !== undefined
Expand Down
3 changes: 3 additions & 0 deletions v1/content.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ paths:
rev: /\d+/
tid: /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/
comment: /.*/
page_language: 'en'

/html/{title}:
x-route-filters:
Expand Down Expand Up @@ -868,6 +869,8 @@ definitions:
format: date-time
redirect:
type: boolean
page_language:
type: string

revisionIdentifier:
description: Unique revision identifier
Expand Down

0 comments on commit d27f4f8

Please sign in to comment.