mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-10-31 22:40:01 +00:00
custom emoji base
This commit is contained in:
parent
257360536a
commit
b984641108
3 changed files with 51 additions and 3 deletions
|
@ -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 (
|
||||
<>
|
||||
|
||||
</>
|
||||
);
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue