From 3ca716445522d3fdc2f685f5e8524f2356a7cd4a Mon Sep 17 00:00:00 2001 From: f0x52 Date: Thu, 13 Oct 2022 10:42:54 +0200 Subject: [frontend] Use new GET custom_emoji admin api (#908) * use new GET custom_emoji admin api * use url instead of static_url, add link to emoji admin api tracking issue * fetch all local emoji --- web/source/settings/redux/reducers/admin.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'web/source/settings/redux/reducers/admin.js') diff --git a/web/source/settings/redux/reducers/admin.js b/web/source/settings/redux/reducers/admin.js index 20d3d748d..666286178 100644 --- a/web/source/settings/redux/reducers/admin.js +++ b/web/source/settings/redux/reducers/admin.js @@ -37,6 +37,7 @@ function emptyBlock() { function emptyEmojiForm() { return { + id: Date.now(), shortcode: "" }; } @@ -53,6 +54,7 @@ module.exports = createSlice({ }, newInstanceBlocks: {}, emoji: {}, + emojiById: {}, newEmoji: emptyEmojiForm() }, reducers: { @@ -113,6 +115,7 @@ module.exports = createSlice({ } state.emoji[emoji.category] = defaultValue(state.emoji[emoji.category], []); state.emoji[emoji.category].push(emoji); + state.emojiById[emoji.id] = emoji; }); }, @@ -124,8 +127,12 @@ module.exports = createSlice({ if (emoji.category == undefined) { emoji.category = "Unsorted"; } + if (emoji.id == undefined) { + emoji.id = Date.now(); + } state.emoji[emoji.category] = defaultValue(state.emoji[emoji.category], []); state.emoji[emoji.category].push(emoji); + state.emojiById[emoji.id] = emoji; }, } }); \ No newline at end of file -- cgit v1.2.3