Mholloway has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/405218 )
Change subject: Hygiene: Remove unused utility method
......................................................................
Hygiene: Remove unused utility method
Change-Id: Iabbc7ca5def69d962f3f069f7d7cb94cfe6c3699
---
M lib/mwapi.js
M test/lib/mwapi/image-test.js
2 files changed, 0 insertions(+), 41 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/mobileapps
refs/changes/18/405218/1
diff --git a/lib/mwapi.js b/lib/mwapi.js
index f96edea..0750aa1 100644
--- a/lib/mwapi.js
+++ b/lib/mwapi.js
@@ -326,14 +326,6 @@
return api.mwApiGet(app, req.params.domain, query);
};
-mwapi.scaledThumbObj = function(thumb, originalWidth, desiredWidth) {
- const source = mwapi.scaledImageUrl(thumb.source, desiredWidth);
- const match = mwapi.WIDTH_IN_IMAGE_URL_REGEX.exec(source);
- const width = match ? parseInt(match[1], 10) : originalWidth;
- const height = Math.round(width * thumb.height / thumb.width);
- return { source, width, height };
-};
-
/**
* Scales a single image thumbnail URL to another size, if possible.
* @param {!string} initialUrl the initial URL for an image
diff --git a/test/lib/mwapi/image-test.js b/test/lib/mwapi/image-test.js
index b820377..774f281 100644
--- a/test/lib/mwapi/image-test.js
+++ b/test/lib/mwapi/image-test.js
@@ -3,7 +3,6 @@
const assert = require('../../utils/assert.js');
const buildUrls = require('../../../lib/mwapi').buildLeadImageUrls;
const scale = require('../../../lib/mwapi').scaledImageUrl;
-const scaledObj = require('../../../lib/mwapi').scaledThumbObj;
const path = '//upload.wikimedia.org/wikipedia/commons/thumb/a/a0';
const httpPath = 'http://upload.wikimedia.org/wikipedia/commons/thumb/a/a0';
@@ -18,38 +17,6 @@
`${prefix}/thumb/0/0b/Cat_poster_1.jpg/120px-Cat_poster_1.jpg`);
assert.deepEqual(scale(`${prefix}/9/96/Vasskertentrance.jpg`, 320),
`${prefix}/9/96/Vasskertentrance.jpg`);
- });
-
- it('thumb objects are scaled if the original image is scalable', () => {
- const prefix = 'https://upload.wikimedia.org/wikipedia/commons';
- const initialHasWidth = {
- source:
`${prefix}/thumb/0/0b/Cat_poster_1.jpg/1280px-Cat_poster_1.jpg`,
- width: 1280,
- height: 840
- };
- const initialNoWidth = {
- source: `${prefix}/9/96/Vasskertentrance.jpg`,
- width: 800,
- height: 533
- };
- assert.deepEqual(scaledObj(initialHasWidth, 5935, 320),
- {
- source:
`${prefix}/thumb/0/0b/Cat_poster_1.jpg/320px-Cat_poster_1.jpg`,
- width: 320,
- height: 210
- });
- assert.deepEqual(scaledObj(initialHasWidth, 5935, 1600),
- {
- source:
`${prefix}/thumb/0/0b/Cat_poster_1.jpg/1280px-Cat_poster_1.jpg`,
- width: 1280,
- height: 840
- });
- assert.deepEqual(scaledObj(initialNoWidth, 800, 320),
- {
- source: `${prefix}/9/96/Vasskertentrance.jpg`,
- width: 800,
- height: 533
- });
});
it('buildLeadImageUrls("a") should return all "a"s', () => {
--
To view, visit https://gerrit.wikimedia.org/r/405218
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iabbc7ca5def69d962f3f069f7d7cb94cfe6c3699
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits