Improve custom emoji managemant
This commit is contained in:
parent
5ac4c48ad1
commit
f5f7654f4b
5 changed files with 86 additions and 81 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import $ from 'cafy';
|
||||
import define from '../../../define';
|
||||
import { detectUrlMime } from '../../../../../misc/detect-url-mime';
|
||||
import { ID } from '../../../../../misc/cafy-id';
|
||||
import { Emojis } from '../../../../../models';
|
||||
import { getConnection } from 'typeorm';
|
||||
|
|
@ -29,10 +28,6 @@ export const meta = {
|
|||
validator: $.optional.str
|
||||
},
|
||||
|
||||
url: {
|
||||
validator: $.str
|
||||
},
|
||||
|
||||
aliases: {
|
||||
validator: $.arr($.str)
|
||||
}
|
||||
|
|
@ -52,15 +47,11 @@ export default define(meta, async (ps) => {
|
|||
|
||||
if (emoji == null) throw new ApiError(meta.errors.noSuchEmoji);
|
||||
|
||||
const type = await detectUrlMime(ps.url);
|
||||
|
||||
await Emojis.update(emoji.id, {
|
||||
updatedAt: new Date(),
|
||||
name: ps.name,
|
||||
category: ps.category,
|
||||
aliases: ps.aliases,
|
||||
url: ps.url,
|
||||
type,
|
||||
});
|
||||
|
||||
await getConnection().queryResultCache!.remove(['meta_emojis']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue