Jdlrobson has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/366909 )
Change subject: Expose content model in response
......................................................................
Expose content model in response
Certain pages are not wikitext. This flags those to the client.
e.g.
meta.wikimedia.org/wiki/Schema:RelatedArticles
Change-Id: Idb67a564a386cad86a5412cf5f0d885bb2e56bd7
---
M lib/mwapi.js
M routes/mobile-sections.js
M test/features/mobile-sections-lead/pagecontent.js
3 files changed, 12 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps
refs/changes/09/366909/1
diff --git a/lib/mwapi.js b/lib/mwapi.js
index d092d2b..0ade581 100644
--- a/lib/mwapi.js
+++ b/lib/mwapi.js
@@ -123,7 +123,7 @@
mwapi.getMetadata = function(app, req) {
const props = ['languagecount', 'thumb', 'image', 'id', 'revision',
'description',
'lastmodified', 'lastmodifiedby', 'normalizedtitle', 'displaytitle',
'protection',
- 'editable', 'namespace', 'pageprops'];
+ 'editable', 'namespace', 'pageprops', 'contentmodel'];
const query = {
action: 'mobileview',
diff --git a/routes/mobile-sections.js b/routes/mobile-sections.js
index 719a6a5..8fee414 100644
--- a/routes/mobile-sections.js
+++ b/routes/mobile-sections.js
@@ -120,6 +120,7 @@
return {
ns: input.meta.ns,
+ contentmodel: input.meta.contentmodel,
userinfo: input.meta.userinfo,
imageinfo: input.meta.imageinfo,
id: input.meta.id,
diff --git a/test/features/mobile-sections-lead/pagecontent.js
b/test/features/mobile-sections-lead/pagecontent.js
index 95a612f..827baf2 100644
--- a/test/features/mobile-sections-lead/pagecontent.js
+++ b/test/features/mobile-sections-lead/pagecontent.js
@@ -284,4 +284,14 @@
'Disambiguation flag is missing in meta data.');
});
});
+ it('Content model present in response', () => {
+ const title = 'Schema:RelatedArticles';
+ const uri =
`${server.config.uri}meta.wikimedia.org/v1/page/mobile-sections-lead/${title}`;
+ return preq.get({ uri })
+ .then((res) => {
+ assert.deepEqual(res.status, 200);
+ assert.ok(res.body.contentmodel === 'JsonSchema',
+ 'Article flagged as a JsonSchema.');
+ });
+ });
});
--
To view, visit https://gerrit.wikimedia.org/r/366909
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb67a564a386cad86a5412cf5f0d885bb2e56bd7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits