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:
David Lynch 2016-02-29 10:16:34 -06:00
parent e39d8a744b
commit 7486f74c6f
2 changed files with 10 additions and 1 deletions

View file

@ -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',

View file

@ -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();