diff options
author | 2022-11-08 17:51:44 +0100 | |
---|---|---|
committer | 2022-11-08 17:51:44 +0100 | |
commit | eb25739c340b2c541e37422c2df1ef7b5c4de0f5 (patch) | |
tree | 03b21d945f1f95ad9acf56d5bb7c3d6b45642021 /web/source/settings/redux/reducers/admin.js | |
parent | [chore]: Bump github.com/spf13/viper from 1.13.0 to 1.14.0 (#1003) (diff) | |
download | gotosocial-eb25739c340b2c541e37422c2df1ef7b5c4de0f5.tar.xz |
[frontend] Custom Emoji Deletion (#994)
* re-add eslint
* fix oauth url getting too long
* actually attach single emoji get and delete routes
* basic emoji details + deletion using rtk query
* refactor emoji upload to rtk query
* clean up old redux api+reducers for custom emoji
* fix validation order
* refactor custom emoji form fields
* remove unused requires
* cleanup, fix most eslint errors
* more small eslint fixes
* fix max emoji size
* tiny bit of function documentation
Diffstat (limited to 'web/source/settings/redux/reducers/admin.js')
-rw-r--r-- | web/source/settings/redux/reducers/admin.js | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/web/source/settings/redux/reducers/admin.js b/web/source/settings/redux/reducers/admin.js index 666286178..57ca83d7e 100644 --- a/web/source/settings/redux/reducers/admin.js +++ b/web/source/settings/redux/reducers/admin.js @@ -19,7 +19,6 @@ "use strict"; const { createSlice } = require("@reduxjs/toolkit"); -const defaultValue = require("default-value"); function sortBlocks(blocks) { return blocks.sort((a, b) => { // alphabetical sort @@ -35,13 +34,6 @@ function emptyBlock() { }; } -function emptyEmojiForm() { - return { - id: Date.now(), - shortcode: "" - }; -} - module.exports = createSlice({ name: "admin", initialState: { @@ -52,10 +44,7 @@ module.exports = createSlice({ exportType: "plain", ...emptyBlock() }, - newInstanceBlocks: {}, - emoji: {}, - emojiById: {}, - newEmoji: emptyEmojiForm() + newInstanceBlocks: {} }, reducers: { setBlockedInstances: (state, { payload }) => { @@ -105,34 +94,6 @@ module.exports = createSlice({ state.bulkBlock.list = Object.values(state.blockedInstances).map((entry) => { return entry.domain; }).join("\n"); - }, - - setEmoji: (state, {payload}) => { - state.emoji = {}; - payload.forEach((emoji) => { - if (emoji.category == undefined) { - emoji.category = "Unsorted"; - } - state.emoji[emoji.category] = defaultValue(state.emoji[emoji.category], []); - state.emoji[emoji.category].push(emoji); - state.emojiById[emoji.id] = emoji; - }); - }, - - updateNewEmojiVal: (state, { payload: [key, val] }) => { - state.newEmoji[key] = val; - }, - - addEmoji: (state, {payload: emoji}) => { - 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 |