custom emoji base

This commit is contained in:
f0x 2022-09-16 16:13:32 +02:00
parent 257360536a
commit b984641108
3 changed files with 51 additions and 3 deletions

View file

@ -18,6 +18,39 @@
"use strict"; "use strict";
module.exports = function AdminCustomization() { const Promise = require("bluebird");
return "custom emoji"; const React = require("react");
const Redux = require("react-redux");
const api = require("../lib/api");
const adminActions = require("../redux/reducers/admin").actions;
module.exports = function CustomEmoji() {
return (
<>
<h1>Custom Emoji</h1>
<div>
<EmojiOverview/>
</div>
<div>
<h2>Upload</h2>
</div>
</>
);
}; };
function EmojiOverview() {
const dispatch = Redux.useDispatch();
const emoji = Redux.useSelector((state) => state.admin.emoji);
console.log(emoji);
React.useEffect(() => {
dispatch(api.admin.fetchCustomEmoji());
}, []);
return (
<>
</>
);
}

View file

@ -147,6 +147,16 @@ module.exports = function ({ apiCall, getChanges }) {
return dispatch(apiCall("POST", `/api/v1/admin/media_cleanup?remote_cache_days=${days}`)); return dispatch(apiCall("POST", `/api/v1/admin/media_cleanup?remote_cache_days=${days}`));
}); });
}; };
},
fetchCustomEmoji: function fetchCustomEmoji() {
return function (dispatch, _getState) {
return Promise.try(() => {
return dispatch(apiCall("GET", "/api/v1/custom_emojis"));
}).then((emoji) => {
return dispatch(admin.setEmoji(emoji));
});
};
} }
}; };
return adminAPI; return adminAPI;

View file

@ -43,7 +43,8 @@ module.exports = createSlice({
list: "", list: "",
exportType: "plain", exportType: "plain",
...emptyBlock() ...emptyBlock()
} },
emoji: []
}, },
reducers: { reducers: {
setBlockedInstances: (state, { payload }) => { setBlockedInstances: (state, { payload }) => {
@ -86,6 +87,10 @@ module.exports = createSlice({
state.bulkBlock.list = Object.values(state.blockedInstances).map((entry) => { state.bulkBlock.list = Object.values(state.blockedInstances).map((entry) => {
return entry.domain; return entry.domain;
}).join("\n"); }).join("\n");
},
setEmoji: (state, {payload}) => {
state.emoji = payload;
} }
} }
}); });