mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-09-23 10:21:11 +00:00
gateway: Don't create new object for thumbnail
As noted in the review of I71a8a84, creating a new object to represent the thumbnail is confusing. It's also somewhat wasteful. Since both the MediaWiki API and RESTBase both agree on using "source" as the key for the thumbnail's URL, it's reasonable to use it in the gateway and renderer. Bug: T152004 Change-Id: Ie1346d13b6e88004b817f5968448188ed83cfda4
This commit is contained in:
parent
e3ae38f966
commit
622f2af318
|
@ -96,9 +96,6 @@
|
|||
|
||||
if ( page.thumbnail ) {
|
||||
result.thumbnail = page.thumbnail;
|
||||
|
||||
result.thumbnail.url = result.thumbnail.source;
|
||||
delete ( result.thumbnail.source );
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -350,9 +350,9 @@
|
|||
( tall && thumbHeight < SIZES.portraitImage.h ) ||
|
||||
// These characters in URL that could inject CSS and thus JS
|
||||
(
|
||||
rawThumbnail.url.indexOf( '\\' ) > -1 ||
|
||||
rawThumbnail.url.indexOf( '\'' ) > -1 ||
|
||||
rawThumbnail.url.indexOf( '\"' ) > -1
|
||||
rawThumbnail.source.indexOf( '\\' ) > -1 ||
|
||||
rawThumbnail.source.indexOf( '\'' ) > -1 ||
|
||||
rawThumbnail.source.indexOf( '\"' ) > -1
|
||||
)
|
||||
) {
|
||||
return null;
|
||||
|
@ -379,7 +379,7 @@
|
|||
return {
|
||||
el: createThumbnailElement(
|
||||
tall ? 'mwe-popups-is-tall' : 'mwe-popups-is-not-tall',
|
||||
rawThumbnail.url,
|
||||
rawThumbnail.source,
|
||||
x,
|
||||
y,
|
||||
thumbWidth,
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
url: 'https://en.wikipedia.org/wiki/Rick_Astley',
|
||||
thumbnail: {
|
||||
height: 300,
|
||||
url: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Rick_Astley_-_Pepsifest_2009.jpg/200px-Rick_Astley_-_Pepsifest_2009.jpg',
|
||||
source: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Rick_Astley_-_Pepsifest_2009.jpg/200px-Rick_Astley_-_Pepsifest_2009.jpg',
|
||||
width: 200
|
||||
},
|
||||
lastModified: new Date( '2016-11-10T00:14:14Z' ),
|
||||
|
|
Loading…
Reference in a new issue