jenkins-bot has submitted this change and it was merged.

Change subject: Use siteinfo for gallery options
......................................................................


Use siteinfo for gallery options

 * Now that T151360 is resolved.

Change-Id: I50b0e20537d9a870693d24dae5312e7a509fdaac
---
M lib/config/WikiConfig.js
M lib/ext/Gallery/index.js
2 files changed, 14 insertions(+), 11 deletions(-)

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



diff --git a/lib/config/WikiConfig.js b/lib/config/WikiConfig.js
index 905d89d..f266f53 100644
--- a/lib/config/WikiConfig.js
+++ b/lib/config/WikiConfig.js
@@ -46,9 +46,16 @@
                namespaces: resultConf.namespaces,
                namespacealiases: resultConf.namespacealiases,
                general: {
-                       "case": resultConf.general["case"],
-                       lang: resultConf.general.lang,
-                       legaltitlechars: resultConf.general.legaltitlechars,
+                       "case": general["case"],
+                       lang: general.lang,
+                       legaltitlechars: general.legaltitlechars,
+                       // For the gallery extension
+                       galleryoptions: Object.assign({
+                               imagesPerRow: 0,
+                               imageWidth: 120,
+                               imageHeight: 120,
+                               mode: "traditional",
+                       }, general.galleryoptions),
                },
        };
 
diff --git a/lib/ext/Gallery/index.js b/lib/ext/Gallery/index.js
index c793b33..b1fb315 100644
--- a/lib/ext/Gallery/index.js
+++ b/lib/ext/Gallery/index.js
@@ -15,7 +15,9 @@
 
 var modes = require('./modes.js');
 
-var Opts = function(attrs) {
+var Opts = function(env, attrs) {
+       Object.assign(this, env.conf.wiki.siteInfo.general.galleryoptions);
+
        var perrow = parseInt(attrs.perrow, 10);
        if (!Number.isNaN(perrow)) { this.imagesPerRow = perrow; }
 
@@ -31,12 +33,6 @@
        this.showfilename = (attrs.showfilename !== undefined);
        this.caption = attrs.caption;
 };
-
-// FIXME: Expose `wgGalleryOptions` from the MW API
-Opts.prototype.imagesPerRow = 0;
-Opts.prototype.imageWidth = 120;
-Opts.prototype.imageHeight = 120;
-Opts.prototype.mode = 'traditional';
 
 // FIXME: This is too permissive.  The php implementation only calls
 // `replaceInternalLinks` on the gallery caption.  We should have a new
@@ -160,7 +156,7 @@
 var tokenHandler = function(manager, pipelineOpts, extToken, cb) {
        var env = manager.env;
        var argDict = Util.getArgInfo(extToken).dict;
-       var opts = new Opts(argDict.attrs);
+       var opts = new Opts(env, argDict.attrs);
 
        // FIXME: Only remove after VE switches to editing HTML.
        if (env.nativeGallery) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I50b0e20537d9a870693d24dae5312e7a509fdaac
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Arlolra <abrea...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Subramanya Sastry <ssas...@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