2023-07-27 05:31:52 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-08-05 01:33:00 +00:00
|
|
|
import { Injectable } from '@nestjs/common';
|
2022-09-17 18:27:08 +00:00
|
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
2023-04-06 02:14:43 +00:00
|
|
|
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
2018-11-03 18:18:32 +00:00
|
|
|
|
|
|
|
export const meta = {
|
2019-02-23 02:20:58 +00:00
|
|
|
tags: ['admin'],
|
|
|
|
|
2023-12-18 03:32:26 +00:00
|
|
|
kind: 'write:admin',
|
|
|
|
|
2022-01-18 13:27:10 +00:00
|
|
|
requireCredential: true,
|
2023-01-15 11:52:53 +00:00
|
|
|
requireRolePolicy: 'canManageCustomEmojis',
|
2018-11-03 18:18:32 +00:00
|
|
|
|
2019-10-15 19:03:18 +00:00
|
|
|
errors: {
|
|
|
|
noSuchEmoji: {
|
|
|
|
message: 'No such emoji.',
|
|
|
|
code: 'NO_SUCH_EMOJI',
|
2021-12-09 14:58:30 +00:00
|
|
|
id: 'be83669b-773a-44b7-b1f8-e5e5170ac3c2',
|
|
|
|
},
|
|
|
|
},
|
2022-01-18 13:27:10 +00:00
|
|
|
} as const;
|
2018-11-03 18:18:32 +00:00
|
|
|
|
2022-02-20 04:15:40 +00:00
|
|
|
export const paramDef = {
|
2022-02-19 05:05:32 +00:00
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
id: { type: 'string', format: 'misskey:id' },
|
|
|
|
},
|
|
|
|
required: ['id'],
|
|
|
|
} as const;
|
|
|
|
|
2022-09-17 18:27:08 +00:00
|
|
|
@Injectable()
|
2023-08-17 12:20:58 +00:00
|
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
2022-09-17 18:27:08 +00:00
|
|
|
constructor(
|
2023-04-06 02:14:43 +00:00
|
|
|
private customEmojiService: CustomEmojiService,
|
2022-09-17 18:27:08 +00:00
|
|
|
) {
|
|
|
|
super(meta, paramDef, async (ps, me) => {
|
2023-09-24 01:57:24 +00:00
|
|
|
await this.customEmojiService.delete(ps.id, me);
|
2022-09-17 18:27:08 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|