Update to support PolyGerrit
Updated script to support both GWT and PolyGerrit, though it does not
work, the 'comment' event is not yet supported by PolyGerrit.
Change-Id: I0c262819128e1add5221b47069ed58be3cc38b31
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/HttpModule.java
index d6ab5be..3737710 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/HttpModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/HttpModule.java
@@ -25,5 +25,6 @@
protected void configureServlets() {
DynamicSet.bind(binder(), WebUiPlugin.class).toInstance(new GwtPlugin("emoticons"));
DynamicSet.bind(binder(), WebUiPlugin.class).toInstance(new JavaScriptPlugin("emoticons.js"));
+ DynamicSet.bind(binder(), WebUiPlugin.class).toInstance(new JavaScriptPlugin("emoticons.html"));
}
}
diff --git a/src/main/resources/static/emoticons.html b/src/main/resources/static/emoticons.html
new file mode 100644
index 0000000..21bf3ab
--- /dev/null
+++ b/src/main/resources/static/emoticons.html
@@ -0,0 +1,17 @@
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+<dom-module id="emoticons">
+ <script src="./emoticons.js"></script>
+</dom-module>
diff --git a/src/main/resources/static/emoticons.js b/src/main/resources/static/emoticons.js
index f761810..1a29d94 100644
--- a/src/main/resources/static/emoticons.js
+++ b/src/main/resources/static/emoticons.js
@@ -18,7 +18,7 @@
if (prefs !== null) {
insertEmoticons(e, prefs)
} else {
- Gerrit.get('/accounts/self/' + self.getPluginName()
+ self.get('/accounts/self/' + self.getPluginName()
+ '~preference', function(prefs) {
storePrefsInCookie(prefs);
insertEmoticons(e, prefs)
@@ -97,5 +97,5 @@
});
}
- Gerrit.on('comment', onComment);
+ self.on('comment', onComment);
});