Fix preference retrieval
To access API, need to use Gerrit.get() in GWT and self.restApi.get()
in polygerrit.
Change-Id: Iafdc057c2d824a9da07d1f3e1512347a4adc65d9
diff --git a/src/main/resources/static/emoticons.js b/src/main/resources/static/emoticons.js
index 1a29d94..996487d 100644
--- a/src/main/resources/static/emoticons.js
+++ b/src/main/resources/static/emoticons.js
@@ -13,12 +13,21 @@
// limitations under the License.
Gerrit.install(function(self) {
+
+ function get(url, callback) {
+ if (window.Polymer) {
+ self.restApi().get(url).then(callback)
+ } else {
+ Gerrit.get(url, callback)
+ }
+ }
+
function onComment(e) {
var prefs = getPrefsFromCookie();
if (prefs !== null) {
insertEmoticons(e, prefs)
} else {
- self.get('/accounts/self/' + self.getPluginName()
+ get('/accounts/self/' + self.getPluginName()
+ '~preference', function(prefs) {
storePrefsInCookie(prefs);
insertEmoticons(e, prefs)