Merge "Fix preference retrieval" into stable-2.16
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)