mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-05 11:15:54 +02:00
Improve custom emoji managemant
This commit is contained in:
@@ -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']);
|
||||
|
||||
Reference in New Issue
Block a user