From 2f2286921da214276635fdcd22de744b27ab86a9 Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Thu, 17 Jan 2019 13:51:13 +0100 Subject: [PATCH] Change getPageSummary() to use mw.Title object instead of string This is split from the current draft patch Ie0ccb03. This is part of a series of very small patches that prepare the code for new types of popups. Bug: T213415 Change-Id: I00d46a716c0e6ada82ffc0034a7dd5582363c657 --- resources/dist/index.js | Bin 38373 -> 38409 bytes resources/dist/index.js.map.json | Bin 185195 -> 185476 bytes src/actions.js | 2 +- src/gateway/index.js | 2 +- src/gateway/mediawiki.js | 6 +++++- src/gateway/rest.js | 9 +++++++-- tests/node-qunit/actions.test.js | 7 ++++--- tests/node-qunit/gateway/mediawiki.test.js | 9 +++++---- tests/node-qunit/gateway/rest.test.js | 13 +++++++------ 9 files changed, 30 insertions(+), 18 deletions(-) diff --git a/resources/dist/index.js b/resources/dist/index.js index db7e34be573458f561f41d94b15f917dd1cc93aa..057b2c9b1d02ec604c3c1286975f6f2694085f15 100644 GIT binary patch delta 171 zcmaF5nyGUQ(}tNkim7_(sU-nLscD%NsVOc=8k#!!wwW45n$|_BC8b4q3i*@$jU|Iq z)znh;N-|4wQfq27Qf({sQY%VQ^HMYv4RnAa)wMd+U`eZ@T1`!zvi!^x1p`}K+f{b+V9dFJu1Z1-eUF1<>8F+0}TK8Dq)j2bruo07Z{GUH||9 delta 160 zcmeBN!}N4D(}tNk^_d!}n$|_BC8b4q3PpM)8L4?1X{C9|C7Jno8kw5aP?=0MwM@N| z%#xhcni`Ev+e*FEijvg46b(fKoy?k=>RO#@u%uOLt)`|_f`x;fL%culrrevMhg=C0Ul`ge0=9)%#&d z*25`r2q}+*K$5%3CWIt~1d=o~2`pg)XA-XbDA4j3Gt9ID{hf0^ zt-ZS@^zo17?>^5x&)+%s{`9l&yzj+#zWVm<>aPy(J^S|UU*C52hljs+#MV9g_3(#n zwpC@CKi*Q6$~U!tcGU1Y<3ez ziPG>TX9WKSs39bsVRX`Bfx3Ep%G_$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&@DOl1?2D0PtM`9nrZdFFh{eTa z#n2zZqKSm#QY+kFMZHb#84U<9l+^vllF^2X<4m2i2klqkmho{3fHJ19Ml!gl1*m3m zy-G@|>hEz8Ht^JI)n7$7zgAJA!3&-&0u#hkQvdx8*EL=SRmLA { - const xhr = gateway.getPageSummary( titleText ); + const xhr = gateway.getPageSummary( title ); dispatch( timedAction( { type: types.FETCH_START, diff --git a/src/gateway/index.js b/src/gateway/index.js index 5ebdab624..89ed873db 100644 --- a/src/gateway/index.js +++ b/src/gateway/index.js @@ -28,7 +28,7 @@ const mw = mediaWiki, * If the underlying request is successful and contains data about the page, * then the resulting promise will resolve. If not, then it will reject. * - * @typedef {Function(string): AbortPromise} GetPageSummary + * @typedef {Function(mw.Title): AbortPromise} GetPageSummary */ /** diff --git a/src/gateway/mediawiki.js b/src/gateway/mediawiki.js index fe52c2ae0..2ec69c466 100644 --- a/src/gateway/mediawiki.js +++ b/src/gateway/mediawiki.js @@ -62,8 +62,12 @@ export default function createMediaWikiApiGateway( api, config ) { } ); } + /** + * @param {mw.Title} title + * @returns {AbortPromise} + */ function getPageSummary( title ) { - const xhr = fetch( title ); + const xhr = fetch( title.getPrefixedDb() ); return xhr.then( ( data ) => { const page = extractPageFromResponse( data ); const plainTextExtract = formatPlainTextExtract( page ); diff --git a/src/gateway/rest.js b/src/gateway/rest.js index 05ada48c8..eac53ace4 100644 --- a/src/gateway/rest.js +++ b/src/gateway/rest.js @@ -48,12 +48,17 @@ export default function createRESTBaseGateway( ajax, config, extractParser ) { } ); } + /** + * @param {mw.Title} title + * @returns {AbortPromise} + */ function getPageSummary( title ) { - const xhr = fetch( title ); + const titleText = title.getPrefixedDb(), + xhr = fetch( titleText ); return xhr.then( ( page ) => { // Endpoint response may be empty or simply missing a title. if ( !page || !page.title ) { - page = $.extend( true, page || {}, { title } ); + page = $.extend( true, page || {}, { title: titleText } ); } // And extract may be omitted if empty string if ( page.extract === undefined ) { diff --git a/tests/node-qunit/actions.test.js b/tests/node-qunit/actions.test.js index b407d5a5f..306710456 100644 --- a/tests/node-qunit/actions.test.js +++ b/tests/node-qunit/actions.test.js @@ -4,7 +4,8 @@ import * as WaitModule from '../../src/wait'; import actionTypes from '../../src/actionTypes'; const mw = mediaWiki, - REFERRER = 'https://en.wikipedia.org/wiki/Kitten'; + REFERRER = 'https://en.wikipedia.org/wiki/Kitten', + TEST_TITLE = createStubTitle( 1, 'Foo' ); function generateToken() { return 'ABC'; @@ -82,7 +83,7 @@ function setupWait( module ) { * @return {void} */ function setupEl( module ) { - module.title = createStubTitle( 1, 'Foo' ); + module.title = TEST_TITLE; module.el = $( '' ).eq( 0 ); } @@ -279,7 +280,7 @@ QUnit.test( 'it should fetch data from the gateway immediately', function ( asse this.fetch(); assert.ok( - this.gateway.getPageSummary.calledWith( 'Foo' ), + this.gateway.getPageSummary.calledWith( TEST_TITLE ), 'The gateway was called with the correct arguments.' ); diff --git a/tests/node-qunit/gateway/mediawiki.test.js b/tests/node-qunit/gateway/mediawiki.test.js index da183c818..1ad9fbc43 100644 --- a/tests/node-qunit/gateway/mediawiki.test.js +++ b/tests/node-qunit/gateway/mediawiki.test.js @@ -1,3 +1,4 @@ +import { createStubTitle } from '../stubs'; import { createModel } from '../../../src/preview/model'; import createMediaWikiApiGateway from '../../../src/gateway/mediawiki'; @@ -166,7 +167,7 @@ QUnit.test( 'MediaWiki API gateway handles API failure', function ( assert ) { }, gateway = createMediaWikiApiGateway( api, DEFAULT_CONSTANTS ); - return gateway.getPageSummary( 'Test Title' ).catch( () => { + return gateway.getPageSummary( createStubTitle( 1, 'Test Title' ) ).catch( () => { assert.ok( true, 'The gateway threw an error.' ); } ); } ); @@ -179,7 +180,7 @@ QUnit.test( 'MediaWiki API gateway returns the correct data', function ( assert }, gateway = createMediaWikiApiGateway( api, DEFAULT_CONSTANTS ); - return gateway.getPageSummary( 'Test Title' ).then( ( result ) => { + return gateway.getPageSummary( createStubTitle( 1, 'Test Title' ) ).then( ( result ) => { assert.deepEqual( result, MEDIAWIKI_API_RESPONSE_PREVIEW_MODEL, @@ -221,7 +222,7 @@ QUnit.test( 'MediaWiki API gateway handles missing pages', function ( assert ) { }, gateway = createMediaWikiApiGateway( api, DEFAULT_CONSTANTS ); - return gateway.getPageSummary( 'Test Title' ).then( ( result ) => { + return gateway.getPageSummary( createStubTitle( 1, 'Test Title' ) ).then( ( result ) => { assert.deepEqual( result, model, @@ -240,7 +241,7 @@ QUnit.test( 'MediaWiki API gateway is abortable', function ( assert ) { }, gateway = createMediaWikiApiGateway( api, DEFAULT_CONSTANTS ); - const xhr = gateway.getPageSummary( 'Test Title' ); + const xhr = gateway.getPageSummary( createStubTitle( 1, 'Test Title' ) ); const chain = xhr.then( () => { assert.ok( false, 'It never calls a thenable after rejection' ); diff --git a/tests/node-qunit/gateway/rest.test.js b/tests/node-qunit/gateway/rest.test.js index 719ddc5d4..40ca4841f 100644 --- a/tests/node-qunit/gateway/rest.test.js +++ b/tests/node-qunit/gateway/rest.test.js @@ -1,3 +1,4 @@ +import { createStubTitle } from '../stubs'; import { createModel } from '../../../src/preview/model'; import createRESTBaseGateway from '../../../src/gateway/rest'; @@ -357,7 +358,7 @@ QUnit.test( 'RESTBase gateway handles API failure', function ( assert ) { .returns( $.Deferred().reject( { status: 500 } ).promise() ), gateway = createRESTBaseGateway( api, {} ); - return gateway.getPageSummary( 'Test Title' ).catch( () => { + return gateway.getPageSummary( createStubTitle( 1, 'Test Title' ) ).catch( () => { assert.ok( true, 'The gateway threw an error.' ); } ); } ); @@ -367,7 +368,7 @@ QUnit.test( 'RESTBase gateway handles 404 as a failure', function ( assert ) { .returns( $.Deferred().reject( { status: 404 } ).promise() ), gateway = createRESTBaseGateway( api, {} ); - return gateway.getPageSummary( 'Test Title' ).catch( () => { + return gateway.getPageSummary( createStubTitle( 1, 'Test Title' ) ).catch( () => { assert.ok( true, 'The gateway threw an error.' ); } ); } ); @@ -379,7 +380,7 @@ QUnit.test( 'RESTBase gateway returns the correct data ', function ( assert ) { gateway = createRESTBaseGateway( api, DEFAULT_CONSTANTS, provideParsedExtract ); - return gateway.getPageSummary( 'Test Title' ).then( ( result ) => { + return gateway.getPageSummary( createStubTitle( 1, 'Test Title' ) ).then( ( result ) => { assert.deepEqual( result, RESTBASE_RESPONSE_PREVIEW_MODEL, @@ -406,7 +407,7 @@ QUnit.test( 'RESTBase gateway handles missing extracts', function ( assert ) { gateway = createRESTBaseGateway( api, DEFAULT_CONSTANTS, provideParsedExtract ); - return gateway.getPageSummary( 'Test Title with missing extract' ) + return gateway.getPageSummary( createStubTitle( 1, 'Test Title with missing extract' ) ) .then( ( result ) => { assert.strictEqual( result.title, 'Test Title with missing extract', 'Title' ); assert.strictEqual( result.extract, '!!', 'Extract' ); @@ -419,7 +420,7 @@ QUnit.test( 'RESTBase gateway handles no content success responses', function ( gateway = createRESTBaseGateway( api, DEFAULT_CONSTANTS, provideParsedExtract ); - return gateway.getPageSummary( 'Test Title with empty response' ) + return gateway.getPageSummary( createStubTitle( 1, 'Test Title with empty response' ) ) .then( ( result ) => { assert.strictEqual( result.title, 'Test Title with empty response', 'Title' ); assert.strictEqual( result.extract, '!!', 'Extract' ); @@ -439,7 +440,7 @@ QUnit.test( 'RESTBase gateway is abortable', function ( assert ) { gateway = createRESTBaseGateway( api, DEFAULT_CONSTANTS, provideParsedExtract ); - const xhr = gateway.getPageSummary( 'Test Title' ); + const xhr = gateway.getPageSummary( createStubTitle( 1, 'Test Title' ) ); const chain = xhr.then( () => { assert.ok( false, 'It never calls a thenable after rejection' );