mirror of
1
Fork 0

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";
module.exports = function AdminCustomization() {
return "custom emoji";
const Promise = require("bluebird");
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}`));
});
};
},
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;

View File

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