Jdlrobson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366587 )

Change subject: Expose disambiguation flag on pages
......................................................................

Expose disambiguation flag on pages

This will be needed by web as part of the page preview service.

Additional changes:
* pageprop wikibase_item was previously obtained via an unsupported
way (not even sure how that works) - the mobileview API uses
pageprops not ppprops

Change-Id: Ie368fe7ad9c1d667a77a3af6d744ba157c2658c1
---
M lib/mwapi.js
M routes/mobile-sections.js
M spec.yaml
M test/features/mobile-sections-lead/pagecontent.js
4 files changed, 23 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps 
refs/changes/87/366587/1

diff --git a/lib/mwapi.js b/lib/mwapi.js
index 9aeb202..cceb078 100644
--- a/lib/mwapi.js
+++ b/lib/mwapi.js
@@ -130,7 +130,7 @@
         formatversion: 2,
         page: req.params.title,
         prop: props.join('|'),
-        ppprop: 'wikibase_item',
+        pageprops: 'wikibase_item|disambiguation',
         thumbwidth: mwapi.LEAD_IMAGE_XL
     };
     return api.mwApiGet(app, req.params.domain, query)
diff --git a/routes/mobile-sections.js b/routes/mobile-sections.js
index 9b8f720..37e2687 100644
--- a/routes/mobile-sections.js
+++ b/routes/mobile-sections.js
@@ -126,6 +126,7 @@
         normalizedtitle: input.meta.normalizedtitle,
         redirected: input.meta.redirected,
         wikibase_item: input.meta.pageprops && 
input.meta.pageprops.wikibase_item,
+        disambiguation: input.meta.pageprops && 
input.meta.pageprops.disambiguation !== undefined,
         description: input.meta.description,
         protection: input.meta.protection,
         editable: input.meta.editable,
diff --git a/spec.yaml b/spec.yaml
index 3618cf5..fc63c30 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -608,6 +608,7 @@
                 protection: /.+/
                 editable: /.+/
                 mainpage: true
+                disambiguation: false
                 languagecount: /.+/
                 ns: /.+/
                 sections: [ /.+/ ]
diff --git a/test/features/mobile-sections-lead/pagecontent.js 
b/test/features/mobile-sections-lead/pagecontent.js
index af6cae3..38adc17 100644
--- a/test/features/mobile-sections-lead/pagecontent.js
+++ b/test/features/mobile-sections-lead/pagecontent.js
@@ -264,4 +264,24 @@
                 assert.ok(res.body.issues === undefined, err);
             });
     });
+    it('Disambiguation pages are flagged.', () => {
+        const title = 'Barack_(disambiguation)';
+        const uri = 
`${server.config.uri}en.wikipedia.org/v1/page/mobile-sections-lead/${title}`;
+        return preq.get({ uri })
+            .then((res) => {
+                assert.deepEqual(res.status, 200);
+                assert.ok(res.body.disambiguation,
+                    'Disambiguation flag is present in meta data.');
+            });
+    });
+    it('Disambiguation pages are not flagged.', () => {
+        const title = 'Barack Obama';
+        const uri = 
`${server.config.uri}en.wikipedia.org/v1/page/mobile-sections-lead/${title}`;
+        return preq.get({ uri })
+            .then((res) => {
+                assert.deepEqual(res.status, 200);
+                assert.ok(res.body.disambiguation === false,
+                    'Disambiguation flag is missing in meta data.');
+            });
+    });
 });

-- 
To view, visit https://gerrit.wikimedia.org/r/366587
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie368fe7ad9c1d667a77a3af6d744ba157c2658c1
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

Reply via email to