jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/339598 )

Change subject: useVideoInfo is only for legacy requests
......................................................................


useVideoInfo is only for legacy requests

 * Also, handle batch api thumb error.

Change-Id: I0d5c1e1a9feb92b070b32f15fb9ad9728d00b2a0
---
M lib/config/WikiConfig.js
M lib/wt2html/tt/LinkHandler.js
2 files changed, 8 insertions(+), 5 deletions(-)

Approvals:
  Tim Starling: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/config/WikiConfig.js b/lib/config/WikiConfig.js
index 0e12724..2e3e254 100644
--- a/lib/config/WikiConfig.js
+++ b/lib/config/WikiConfig.js
@@ -818,9 +818,10 @@
 WikiConfig.prototype.detectFeatures = function(env) {
        return ParamInfoRequest.promise(env)
        .then(function(query) {
-               // Do we have the "videoinfo" prop?
-               this.useVideoInfo = Array.isArray(query.parameters)
-                               && query.parameters.some(function(o) {
+               // Do we have the "videoinfo" prop?  Only relevant to legacy 
requests.
+               this.useVideoInfo = !env.conf.parsoid.useBatchAPI &&
+                               Array.isArray(query.parameters) &&
+                               query.parameters.some(function(o) {
                        return o && o.name === 'prop' && 
o.type.indexOf('videoinfo') > -1;
                });
        }.bind(this));
diff --git a/lib/wt2html/tt/LinkHandler.js b/lib/wt2html/tt/LinkHandler.js
index 3bdb812..f066d23 100644
--- a/lib/wt2html/tt/LinkHandler.js
+++ b/lib/wt2html/tt/LinkHandler.js
@@ -1041,13 +1041,13 @@
        var info;
        var errs = [];
 
-       var prop = this.env.conf.wiki.useVideoInfo ? 'videoinfo' : 'imageinfo';
-
        if (!err && data) {
                if (this.env.conf.parsoid.useBatchAPI) {
                        info = data.batchResponse;
                } else {
                        var ns = data.imgns;
+                       // `useVideoInfo` is for legacy requests; batching 
returns thumbdata.
+                       var prop = this.env.conf.wiki.useVideoInfo ? 
'videoinfo' : 'imageinfo';
                        // title is guaranteed to be not null here
                        var image = data.pages[ns + ':' + title.getKey()];
                        if (!image || !image[prop] || !image[prop][0] ||
@@ -1096,6 +1096,8 @@
                } else {
                        errs.push({"key": "missing-image", "message": "This 
image does not exist." });
                }
+       } else if (info.hasOwnProperty('thumberror')) {
+               errs.push({ key: 'thumb-error', 'message': info.thumberror });
        }
 
        var o;

-- 
To view, visit https://gerrit.wikimedia.org/r/339598
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0d5c1e1a9feb92b070b32f15fb9ad9728d00b2a0
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Subramanya Sastry <ssas...@wikimedia.org>
Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to