カスタム絵文字のライセンスを一括でできるように (#10671)

* setlicensebulk追加

* 5時に誤字った!w

* 並び順の変更(set,add,removeの順

* add changelog
This commit is contained in:
nenohi
2023-04-19 08:25:24 +09:00
committed by GitHub
parent b26807b59b
commit 65ff2c2498
6 changed files with 74 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
import { Inject, Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
export const meta = {
tags: ['admin'],
requireCredential: true,
requireRolePolicy: 'canManageCustomEmojis',
} as const;
export const paramDef = {
type: 'object',
properties: {
ids: { type: 'array', items: {
type: 'string', format: 'misskey:id',
} },
license: {
type: 'string',
nullable: true,
description: 'Use `null` to reset the license.',
},
},
required: ['ids'],
} as const;
// eslint-disable-next-line import/no-default-export
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
constructor(
private customEmojiService: CustomEmojiService,
) {
super(meta, paramDef, async (ps, me) => {
await this.customEmojiService.setLicenseBulk(ps.ids, ps.license ?? null);
});
}
}