misskey/packages/frontend/src/pages/admin/custom-emojis-grid.impl.ts

58 lines
1.2 KiB
TypeScript
Raw Normal View History

2024-01-21 02:39:52 +00:00
import * as Misskey from 'misskey-js';
2024-02-03 09:51:35 +00:00
export type RegisterLogItem = {
failed: boolean;
url: string;
name: string;
error?: string;
};
2024-02-01 11:59:30 +00:00
export type GridItem = {
2024-02-04 09:42:03 +00:00
checked: boolean;
id?: string;
fileId?: string;
url: string;
2024-01-27 03:02:50 +00:00
name: string;
2024-02-04 09:42:03 +00:00
host: string;
2024-01-27 03:02:50 +00:00
category: string;
aliases: string;
license: string;
isSensitive: boolean;
localOnly: boolean;
roleIdsThatCanBeUsedThisEmojiAsReaction: string;
}
2024-02-05 07:20:35 +00:00
export function fromEmojiDetailedAdmin(it: Misskey.entities.EmojiDetailedAdmin): GridItem {
2024-02-01 11:59:30 +00:00
return {
2024-02-04 09:42:03 +00:00
checked: false,
2024-02-01 11:59:30 +00:00
id: it.id,
fileId: undefined,
2024-02-05 07:20:35 +00:00
url: it.publicUrl,
2024-02-01 11:59:30 +00:00
name: it.name,
2024-02-04 09:42:03 +00:00
host: it.host ?? '',
2024-02-01 11:59:30 +00:00
category: it.category ?? '',
aliases: it.aliases.join(', '),
license: it.license ?? '',
isSensitive: it.isSensitive,
localOnly: it.localOnly,
roleIdsThatCanBeUsedThisEmojiAsReaction: it.roleIdsThatCanBeUsedThisEmojiAsReaction.join(', '),
};
}
2024-01-22 01:37:44 +00:00
2024-02-01 11:59:30 +00:00
export function fromDriveFile(it: Misskey.entities.DriveFile): GridItem {
return {
2024-02-04 09:42:03 +00:00
checked: false,
2024-02-01 11:59:30 +00:00
id: undefined,
fileId: it.id,
url: it.url,
2024-02-03 09:51:35 +00:00
name: it.name.replace(/(\.[a-zA-Z0-9]+)+$/, ''),
2024-02-04 09:42:03 +00:00
host: '',
2024-02-01 11:59:30 +00:00
category: '',
aliases: '',
license: '',
isSensitive: it.isSensitive,
localOnly: false,
roleIdsThatCanBeUsedThisEmojiAsReaction: '',
};
2024-01-21 02:39:52 +00:00
}