mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-29 03:53:09 +02:00
d071d18dd7
* wip * wip * fix * clean up * Update tsconfig.json * Update activitypub.ts * wip
40 lines
930 B
TypeScript
40 lines
930 B
TypeScript
import define from '../../../define.js';
|
|
import { Emojis } from '@/models/index.js';
|
|
import { getConnection, In } from 'typeorm';
|
|
import { ApiError } from '../../../error.js';
|
|
|
|
export const meta = {
|
|
tags: ['admin'],
|
|
|
|
requireCredential: true,
|
|
requireModerator: true,
|
|
} as const;
|
|
|
|
export const paramDef = {
|
|
type: 'object',
|
|
properties: {
|
|
ids: { type: 'array', items: {
|
|
type: 'string', format: 'misskey:id',
|
|
} },
|
|
aliases: { type: 'array', items: {
|
|
type: 'string',
|
|
} },
|
|
},
|
|
required: ['ids', 'aliases'],
|
|
} as const;
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
|
export default define(meta, paramDef, async (ps) => {
|
|
const emojis = await Emojis.find({
|
|
id: In(ps.ids),
|
|
});
|
|
|
|
for (const emoji of emojis) {
|
|
await Emojis.update(emoji.id, {
|
|
updatedAt: new Date(),
|
|
aliases: [...new Set(emoji.aliases.concat(ps.aliases))],
|
|
});
|
|
}
|
|
|
|
await getConnection().queryResultCache!.remove(['meta_emojis']);
|
|
});
|