mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
MWMediaDialog: Only cache relevant information
Trim the cached image data from the media dialog down so that it only caches the same information that would have been fetched for a non-uploaded image. Consistency! Bug: T126081 Change-Id: I0f057c111b66f29c6360e27f97256384f5320b75
This commit is contained in:
parent
e39d8a744b
commit
7486f74c6f
|
@ -37,6 +37,8 @@ ve.init.mw.ImageInfoCache.static.processPage = function ( page ) {
|
|||
* @inheritdoc
|
||||
*/
|
||||
ve.init.mw.ImageInfoCache.prototype.getRequestPromise = function ( subqueue ) {
|
||||
// If you change what `iiprop`s are being fetched, update
|
||||
// ve.ui.MWMediaDialog to add the same ones to the cache.
|
||||
return new mw.Api().get(
|
||||
{
|
||||
action: 'query',
|
||||
|
|
|
@ -891,7 +891,14 @@ ve.ui.MWMediaDialog.prototype.confirmSelectedImage = function () {
|
|||
}
|
||||
|
||||
// Cache
|
||||
obj[ imageTitleText ] = info;
|
||||
// We're trimming the stored data down to be consistent with what
|
||||
// ImageInfoCache.getRequestPromise fetches.
|
||||
obj[ imageTitleText ] = {
|
||||
size: info.size,
|
||||
width: info.width,
|
||||
height: info.height,
|
||||
mediatype: info.mediatype
|
||||
};
|
||||
ve.init.platform.imageInfoCache.set( obj );
|
||||
|
||||
this.checkChanged();
|
||||
|
|
Loading…
Reference in a new issue