diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-06-27 03:48:56 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-06-27 08:51:52 -0500 |
commit | a2a276a81509b9093087dcb7b6eb1cbed7c41e79 (patch) | |
tree | 5486cb2b46f5d037412fde0202ba1331e94df80b | |
parent | 9d6bbc92c978beeec70bec1f2d4a65791fa3f985 (diff) | |
download | gitlab-ce-a2a276a81509b9093087dcb7b6eb1cbed7c41e79.tar.gz |
rename getEmojiCategoryMap and remove unnecessary parameter
-rw-r--r-- | app/assets/javascripts/awards_handler.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/emoji/index.js | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index 6f0384ebebe..f0ccbc4b998 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -133,7 +133,7 @@ export default class AwardsHandler { this.isCreatingEmojiMenu = true; // Render the first category - const categoryMap = Emoji.getEmojiByCategory(); + const categoryMap = Emoji.getEmojiCategoryMap(); const categoryNameKey = Object.keys(categoryMap)[0]; const emojisInCategory = categoryMap[categoryNameKey]; const firstCategory = renderCategory(categoryLabelMap[categoryNameKey], emojisInCategory); @@ -173,7 +173,7 @@ export default class AwardsHandler { } this.isAddingRemainingEmojiMenuCategories = true; - const categoryMap = Emoji.getEmojiByCategory(); + const categoryMap = Emoji.getEmojiCategoryMap(); // Avoid the jank and render the remaining categories separately // This will take more time, but makes UI more responsive diff --git a/app/assets/javascripts/emoji/index.js b/app/assets/javascripts/emoji/index.js index bbecd1e41d1..cac35d6eed5 100644 --- a/app/assets/javascripts/emoji/index.js +++ b/app/assets/javascripts/emoji/index.js @@ -20,10 +20,10 @@ export function filterEmojiNamesByAlias(filter) { return _.uniq(filterEmojiNames(filter).map(name => normalizeEmojiName(name))); } -let emojiByCategory; -export function getEmojiByCategory(category = null) { - if (!emojiByCategory) { - emojiByCategory = { +let emojiCategoryMap; +export function getEmojiCategoryMap() { + if (!emojiCategoryMap) { + emojiCategoryMap = { activity: [], people: [], nature: [], @@ -35,12 +35,12 @@ export function getEmojiByCategory(category = null) { }; Object.keys(emojiMap).forEach((name) => { const emoji = emojiMap[name]; - if (emojiByCategory[emoji.category]) { - emojiByCategory[emoji.category].push(name); + if (emojiCategoryMap[emoji.category]) { + emojiCategoryMap[emoji.category].push(name); } }); } - return category ? emojiByCategory[category] : emojiByCategory; + return emojiCategoryMap; } export function getEmojiInfo(query) { |