summaryrefslogtreecommitdiff
path: root/web/source/settings/redux/reducers/admin.js
diff options
context:
space:
mode:
authorLibravatar f0x52 <f0x@cthu.lu>2022-10-13 10:42:54 +0200
committerLibravatar GitHub <noreply@github.com>2022-10-13 10:42:54 +0200
commit3ca716445522d3fdc2f685f5e8524f2356a7cd4a (patch)
tree861fb28ff53a6434b48fae419ac19383b8347802 /web/source/settings/redux/reducers/admin.js
parent[frontend] use ISO639 library for language selection (#909) (diff)
downloadgotosocial-3ca716445522d3fdc2f685f5e8524f2356a7cd4a.tar.xz
[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
Diffstat (limited to 'web/source/settings/redux/reducers/admin.js')
-rw-r--r--web/source/settings/redux/reducers/admin.js7
1 files changed, 7 insertions, 0 deletions
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