about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/emoji/emoji.js
diff options
context:
space:
mode:
authorNolan Lawson <nolan@nolanlawson.com>2017-10-31 14:58:07 -0700
committerYamagishi Kazutoshi <ykzts@desire.sh>2017-11-01 06:58:07 +0900
commit60f962eedcb8adb9ea2856cda270117ec41716d7 (patch)
tree45038a74581a36b4e8decfa60fadfb44799dcfde /app/javascript/mastodon/features/emoji/emoji.js
parent47d56438dafb4cf86e65379c9d7b818bb4236a04 (diff)
Refactor initial state: auto_play_gif (#5576)
Diffstat (limited to 'app/javascript/mastodon/features/emoji/emoji.js')
-rw-r--r--app/javascript/mastodon/features/emoji/emoji.js11
1 files changed, 4 insertions, 7 deletions
diff --git a/app/javascript/mastodon/features/emoji/emoji.js b/app/javascript/mastodon/features/emoji/emoji.js
index b70fc2b37..bda33ca26 100644
--- a/app/javascript/mastodon/features/emoji/emoji.js
+++ b/app/javascript/mastodon/features/emoji/emoji.js
@@ -1,3 +1,4 @@
+import { autoPlayGif } from '../../initial_state';
 import unicodeMapping from './emoji_unicode_mapping_light';
 import Trie from 'substring-trie';
 
@@ -5,8 +6,6 @@ const trie = new Trie(Object.keys(unicodeMapping));
 
 const assetHost = process.env.CDN_HOST || '';
 
-let allowAnimations = false;
-
 const emojify = (str, customEmojis = {}) => {
   let rtn = '';
   for (;;) {
@@ -27,7 +26,7 @@ const emojify = (str, customEmojis = {}) => {
         // now got a replacee as ':shortname:'
         // if you want additional emoji handler, add statements below which set replacement and return true.
         if (shortname in customEmojis) {
-          const filename = allowAnimations ? customEmojis[shortname].url : customEmojis[shortname].static_url;
+          const filename = autoPlayGif ? customEmojis[shortname].url : customEmojis[shortname].static_url;
           replacement = `<img draggable="false" class="emojione" alt="${shortname}" title="${shortname}" src="${filename}" />`;
           return true;
         }
@@ -51,14 +50,12 @@ const emojify = (str, customEmojis = {}) => {
 
 export default emojify;
 
-export const buildCustomEmojis = (customEmojis, overrideAllowAnimations = false) => {
+export const buildCustomEmojis = (customEmojis) => {
   const emojis = [];
 
-  allowAnimations = overrideAllowAnimations;
-
   customEmojis.forEach(emoji => {
     const shortcode = emoji.get('shortcode');
-    const url       = allowAnimations ? emoji.get('url') : emoji.get('static_url');
+    const url       = autoPlayGif ? emoji.get('url') : emoji.get('static_url');
     const name      = shortcode.replace(':', '');
 
     emojis.push({