Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266537

Change subject: Warn if prefix/domain is not unique during configuration.
......................................................................

Warn if prefix/domain is not unique during configuration.

There was at least one user on Talk:Parsoid who was tripped up by
this; try to make the problem more obvious.

Change-Id: I6f13ebb947fd437c63efefda3fcf2d857c6752e7
---
M lib/config/ParsoidConfig.js
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/37/266537/1

diff --git a/lib/config/ParsoidConfig.js b/lib/config/ParsoidConfig.js
index 2ab8c80..3d29979 100644
--- a/lib/config/ParsoidConfig.js
+++ b/lib/config/ParsoidConfig.js
@@ -514,7 +514,20 @@
                apiConf.extensions = Util.clone(this.defaultNativeExtensions);
        }
 
+       if (this.reverseMwApiMap.has(apiConf.domain)) {
+               console.warn(
+                       "Domain should be unique in ParsoidConfig#setMwApi 
calls:",
+                       apiConf.domain
+               );
+               console.warn(
+                       "(It doesn't have to be an actual domain, just a unique 
string.)"
+               );
+       }
        if (this.mwApiMap.has(prefix)) {
+               console.warn(
+                       "Prefix should be unique in ParsoidConfig#setMwApi 
calls:",
+                       prefix
+               );
                this.reverseMwApiMap.delete(this.mwApiMap.get(prefix).domain);
        }
        this.mwApiMap.set(prefix, apiConf);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f13ebb947fd437c63efefda3fcf2d857c6752e7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <canan...@wikimedia.org>

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

Reply via email to