jenkins-bot has submitted this change and it was merged.

Change subject: Remove mobile-summary endpoint
......................................................................


Remove mobile-summary endpoint

We haven't used it in a while, since RESTBase has a summary endpoint.
Now that the new `formatted` endpoint has an infobox extractor we
don't need this anymore.

Bug: T152135
Change-Id: Ief25d0f80264f91b3db24138945bf4af844983e5
---
D routes/mobile-summary.js
M spec.yaml
D test/features/mobile-summary/pagecontent.js
3 files changed, 0 insertions(+), 119 deletions(-)

Approvals:
  Mholloway: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/routes/mobile-summary.js b/routes/mobile-summary.js
deleted file mode 100644
index 73753c3..0000000
--- a/routes/mobile-summary.js
+++ /dev/null
@@ -1,67 +0,0 @@
-'use strict';
-
-const BBPromise = require('bluebird');
-const domino = require('domino');
-const extractLib = require('../lib/extract');
-const mwapi = require('../lib/mwapi');
-const mUtil = require('../lib/mobile-util');
-const parse = require('../lib/parseProperty');
-const parsoid = require('../lib/parsoid-access');
-const sUtil = require('../lib/util');
-const transforms = require('../lib/transforms');
-
-/**
- * The main router object
- */
-const router = sUtil.router();
-
-/**
- * The main application object reported when this module is require()d
- */
-let app;
-
-function drillDown(body) {
-    const id = Object.keys(body.query.pages)[0];
-    return body.query.pages[id];
-}
-
-function buildPreview(input) {
-    const lead = domino.createDocument(input.page.sections[0].text);
-    transforms.relocateFirstParagraph(lead);
-    const obj = drillDown(input.extract.body);
-    return {
-        title: obj && obj.title,
-        extract: obj && extractLib.format(obj.extract),
-        thumbnail: mUtil.defaultVal(mUtil.filterEmpty({
-            source: obj && obj.thumbnail && obj.thumbnail.source
-        })),
-        infobox: parse.parseInfobox(lead)
-    };
-}
-
-/**
- * GET {domain}/v1/page/mobile-summary/{title}
- * Gets the preview for the given page title.
- */
-router.get('/mobile-summary/:title', function (req, res) {
-    return BBPromise.props({
-        page: parsoid.pageContentPromise(app, req),
-        extract: mwapi.requestExtract(app, req)
-    }).then(function (response) {
-        const revision = response.page.revision;
-        response = buildPreview(response);
-        res.status(200);
-        mUtil.setETag(req, res, revision);
-        mUtil.setContentType(res, mUtil.CONTENT_TYPES.unpublished);
-        res.json(response).end();
-    });
-});
-
-module.exports = function (appObj) {
-    app = appObj;
-    return {
-        path: '/page',
-        api_version: 1,
-        router: router
-    };
-};
diff --git a/spec.yaml b/spec.yaml
index cceeb33..b8f583f 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -556,30 +556,6 @@
         - application/json
       x-monitor: false
 
-  # from routes/mobile-summary.js
-  /{domain}/v1/page/mobile-summary/{title}:
-    get:
-      tags:
-        - Link preview data of page
-      description: Gets a summary of the page so the user can evaluate if to 
open the page
-      produces:
-        - application/json
-      x-amples:
-        - title: retrieve page preview of Dog page
-          request:
-            params:
-              title: Dog
-          response:
-            status: 200
-            headers:
-              content-type: application/json
-            body:
-              title: Dog
-              extract: /.+/
-              thumbnail:
-                source: /.+/
-              infobox: [ /.+/ ]
-
   # from routes/mobile-text.js
   /{domain}/v1/page/mobile-text/{title}:
     get:
diff --git a/test/features/mobile-summary/pagecontent.js 
b/test/features/mobile-summary/pagecontent.js
deleted file mode 100644
index e45cc01..0000000
--- a/test/features/mobile-summary/pagecontent.js
+++ /dev/null
@@ -1,28 +0,0 @@
-'use strict';
-
-const assert = require('../../utils/assert.js');
-const preq   = require('preq');
-const server = require('../../utils/server.js');
-const headers = require('../../utils/headers.js');
-
-describe('mobile-summary', function() {
-    this.timeout(20000);
-
-    before(function () { return server.start(); });
-
-    it('should respond to GET request with expected headers, incl. CORS and 
CSP headers', function() {
-        return headers.checkHeaders(server.config.uri + 
'en.wikipedia.org/v1/page/mobile-summary/Foobar');
-    });
-    it('Page should have expected properties', function() {
-        return preq.get({ uri: server.config.uri + 
'en.wikipedia.org/v1/page/mobile-summary/Ann_Arbor_Charter_Township,_Michigan' 
})
-            .then(function(res) {
-                const body = res.body;
-                assert.deepEqual(res.status, 200);
-                assert.deepEqual(body.title, 'Ann Arbor Charter Township, 
Michigan');
-                assert.ok(body.extract.indexOf('Ann Arbor Charter Township is 
a charter township') === 0, 'Expected different start of extract');
-                assert.deepEqual(body.thumbnail, {
-                    "source": 
"https://upload.wikimedia.org/wikipedia/commons/thumb/9/9c/Ann_Arbor_Township_hall_and_fire_station.JPG/320px-Ann_Arbor_Township_hall_and_fire_station.JPG";
-                });
-            });
-    });
-});

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ief25d0f80264f91b3db24138945bf4af844983e5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: BearND <bsitzm...@wikimedia.org>
Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: Fjalapeno <cfl...@wikimedia.org>
Gerrit-Reviewer: GWicke <gwi...@wikimedia.org>
Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: Jhernandez <jhernan...@wikimedia.org>
Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org>
Gerrit-Reviewer: Mhurd <mh...@wikimedia.org>
Gerrit-Reviewer: Mobrovac <mobro...@wikimedia.org>
Gerrit-Reviewer: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: Ppchelko <ppche...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to