draftからrequestに
Signed-off-by: mattyatea <mattyacocacora0@gmail.com>
This commit is contained in:
parent
53d250dddf
commit
8fd5eb7010
|
@ -261,7 +261,7 @@ export interface Locale {
|
||||||
"imageUrl": string;
|
"imageUrl": string;
|
||||||
"remove": string;
|
"remove": string;
|
||||||
"removed": string;
|
"removed": string;
|
||||||
"undraftAreYouSure": string;
|
"requestApprovalAreYouSure": string;
|
||||||
"removeAreYouSure": string;
|
"removeAreYouSure": string;
|
||||||
"deleteAreYouSure": string;
|
"deleteAreYouSure": string;
|
||||||
"resetAreYouSure": string;
|
"resetAreYouSure": string;
|
||||||
|
@ -1027,8 +1027,8 @@ export interface Locale {
|
||||||
"sensitiveWordsDescription2": string;
|
"sensitiveWordsDescription2": string;
|
||||||
"notesSearchNotAvailable": string;
|
"notesSearchNotAvailable": string;
|
||||||
"license": string;
|
"license": string;
|
||||||
"draft": string;
|
"requestPending": string;
|
||||||
"undrafted": string;
|
"requestApproval": string;
|
||||||
"requestEmojis": string;
|
"requestEmojis": string;
|
||||||
"emojiNameValidation": string;
|
"emojiNameValidation": string;
|
||||||
"unfavoriteConfirm": string;
|
"unfavoriteConfirm": string;
|
||||||
|
|
|
@ -258,7 +258,7 @@ announcements: "お知らせ"
|
||||||
imageUrl: "画像URL"
|
imageUrl: "画像URL"
|
||||||
remove: "削除"
|
remove: "削除"
|
||||||
removed: "削除しました"
|
removed: "削除しました"
|
||||||
undraftAreYouSure: "「{x}」をドラフト解除しますか?"
|
requestApprovalAreYouSure: "「{x}」のリクエストを承認しますか?"
|
||||||
removeAreYouSure: "「{x}」を削除しますか?"
|
removeAreYouSure: "「{x}」を削除しますか?"
|
||||||
deleteAreYouSure: "「{x}」を削除しますか?"
|
deleteAreYouSure: "「{x}」を削除しますか?"
|
||||||
resetAreYouSure: "リセットしますか?"
|
resetAreYouSure: "リセットしますか?"
|
||||||
|
@ -1024,8 +1024,8 @@ sensitiveWordsDescription: "設定したワードが含まれるノートの公
|
||||||
sensitiveWordsDescription2: "スペースで区切るとAND指定になり、キーワードをスラッシュで囲むと正規表現になります。"
|
sensitiveWordsDescription2: "スペースで区切るとAND指定になり、キーワードをスラッシュで囲むと正規表現になります。"
|
||||||
notesSearchNotAvailable: "ノート検索は利用できません。"
|
notesSearchNotAvailable: "ノート検索は利用できません。"
|
||||||
license: "ライセンス"
|
license: "ライセンス"
|
||||||
draft: "下書き"
|
requestPending: "申請中"
|
||||||
undrafted: "下書き解除"
|
requestApproval: "リクエストを承認"
|
||||||
requestEmojis: "リクエストされている絵文字"
|
requestEmojis: "リクエストされている絵文字"
|
||||||
emojiNameValidation: "名前には英数字と_が利用できます。"
|
emojiNameValidation: "名前には英数字と_が利用できます。"
|
||||||
unfavoriteConfirm: "お気に入り解除しますか?"
|
unfavoriteConfirm: "お気に入り解除しますか?"
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
export class EmojiDraft1697813507149 {
|
|
||||||
name = 'EmojiDraft1697813507149'
|
|
||||||
|
|
||||||
async up(queryRunner) {
|
|
||||||
await queryRunner.query(`CREATE TABLE "emoji_draft" ("id" character varying(32) NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE, "name" character varying(128) NOT NULL, "category" character varying(128), "originalUrl" character varying(512) NOT NULL, "publicUrl" character varying(512) NOT NULL DEFAULT '', "type" character varying(64), "aliases" character varying(128) array NOT NULL DEFAULT '{}', "license" character varying(1024), "fileId" character varying(1024) NOT NULL, "localOnly" boolean NOT NULL DEFAULT false, "isSensitive" boolean NOT NULL DEFAULT false, CONSTRAINT "PK_6c7c36f693e1cb8ba1343e3336f" PRIMARY KEY ("id"))`);
|
|
||||||
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_aw4zqjtyvxcsh797kbpzxmca6x" ON "emoji_draft" ("name") `);
|
|
||||||
}
|
|
||||||
|
|
||||||
async down(queryRunner) {
|
|
||||||
await queryRunner.query(`DROP INDEX "public"."IDX_aw4zqjtyvxcsh797kbpzxmca6x"`);
|
|
||||||
await queryRunner.query(`DROP TABLE "emoji_draft"`);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -87,7 +87,7 @@ import { ClipEntityService } from './entities/ClipEntityService.js';
|
||||||
import { DriveFileEntityService } from './entities/DriveFileEntityService.js';
|
import { DriveFileEntityService } from './entities/DriveFileEntityService.js';
|
||||||
import { DriveFolderEntityService } from './entities/DriveFolderEntityService.js';
|
import { DriveFolderEntityService } from './entities/DriveFolderEntityService.js';
|
||||||
import { EmojiEntityService } from './entities/EmojiEntityService.js';
|
import { EmojiEntityService } from './entities/EmojiEntityService.js';
|
||||||
import { EmojiDraftsEntityService } from './entities/EmojiDraftsEntityService.js';
|
import { EmojiRequestsEntityService } from './entities/EmojiRequestsEntityService.js';
|
||||||
import { FollowingEntityService } from './entities/FollowingEntityService.js';
|
import { FollowingEntityService } from './entities/FollowingEntityService.js';
|
||||||
import { FollowRequestEntityService } from './entities/FollowRequestEntityService.js';
|
import { FollowRequestEntityService } from './entities/FollowRequestEntityService.js';
|
||||||
import { GalleryLikeEntityService } from './entities/GalleryLikeEntityService.js';
|
import { GalleryLikeEntityService } from './entities/GalleryLikeEntityService.js';
|
||||||
|
@ -220,7 +220,7 @@ const $ClipEntityService: Provider = { provide: 'ClipEntityService', useExisting
|
||||||
const $DriveFileEntityService: Provider = { provide: 'DriveFileEntityService', useExisting: DriveFileEntityService };
|
const $DriveFileEntityService: Provider = { provide: 'DriveFileEntityService', useExisting: DriveFileEntityService };
|
||||||
const $DriveFolderEntityService: Provider = { provide: 'DriveFolderEntityService', useExisting: DriveFolderEntityService };
|
const $DriveFolderEntityService: Provider = { provide: 'DriveFolderEntityService', useExisting: DriveFolderEntityService };
|
||||||
const $EmojiEntityService: Provider = { provide: 'EmojiEntityService', useExisting: EmojiEntityService };
|
const $EmojiEntityService: Provider = { provide: 'EmojiEntityService', useExisting: EmojiEntityService };
|
||||||
const $EmojiDraftsEntityService: Provider = { provide: 'EmojiDraftsEntityService', useExisting: EmojiDraftsEntityService };
|
const $EmojiRequestsEntityService: Provider = { provide: 'EmojiRequestsEntityService', useExisting: EmojiRequestsEntityService };
|
||||||
const $FollowingEntityService: Provider = { provide: 'FollowingEntityService', useExisting: FollowingEntityService };
|
const $FollowingEntityService: Provider = { provide: 'FollowingEntityService', useExisting: FollowingEntityService };
|
||||||
const $FollowRequestEntityService: Provider = { provide: 'FollowRequestEntityService', useExisting: FollowRequestEntityService };
|
const $FollowRequestEntityService: Provider = { provide: 'FollowRequestEntityService', useExisting: FollowRequestEntityService };
|
||||||
const $GalleryLikeEntityService: Provider = { provide: 'GalleryLikeEntityService', useExisting: GalleryLikeEntityService };
|
const $GalleryLikeEntityService: Provider = { provide: 'GalleryLikeEntityService', useExisting: GalleryLikeEntityService };
|
||||||
|
@ -353,7 +353,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
|
||||||
DriveFileEntityService,
|
DriveFileEntityService,
|
||||||
DriveFolderEntityService,
|
DriveFolderEntityService,
|
||||||
EmojiEntityService,
|
EmojiEntityService,
|
||||||
EmojiDraftsEntityService,
|
EmojiRequestsEntityService,
|
||||||
FollowingEntityService,
|
FollowingEntityService,
|
||||||
FollowRequestEntityService,
|
FollowRequestEntityService,
|
||||||
GalleryLikeEntityService,
|
GalleryLikeEntityService,
|
||||||
|
@ -481,7 +481,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
|
||||||
$DriveFileEntityService,
|
$DriveFileEntityService,
|
||||||
$DriveFolderEntityService,
|
$DriveFolderEntityService,
|
||||||
$EmojiEntityService,
|
$EmojiEntityService,
|
||||||
$EmojiDraftsEntityService,
|
$EmojiRequestsEntityService,
|
||||||
$FollowingEntityService,
|
$FollowingEntityService,
|
||||||
$FollowRequestEntityService,
|
$FollowRequestEntityService,
|
||||||
$GalleryLikeEntityService,
|
$GalleryLikeEntityService,
|
||||||
|
@ -609,7 +609,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
|
||||||
DriveFileEntityService,
|
DriveFileEntityService,
|
||||||
DriveFolderEntityService,
|
DriveFolderEntityService,
|
||||||
EmojiEntityService,
|
EmojiEntityService,
|
||||||
EmojiDraftsEntityService,
|
EmojiRequestsEntityService,
|
||||||
FollowingEntityService,
|
FollowingEntityService,
|
||||||
FollowRequestEntityService,
|
FollowRequestEntityService,
|
||||||
GalleryLikeEntityService,
|
GalleryLikeEntityService,
|
||||||
|
@ -736,7 +736,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
|
||||||
$DriveFileEntityService,
|
$DriveFileEntityService,
|
||||||
$DriveFolderEntityService,
|
$DriveFolderEntityService,
|
||||||
$EmojiEntityService,
|
$EmojiEntityService,
|
||||||
$EmojiDraftsEntityService,
|
$EmojiRequestsEntityService,
|
||||||
$FollowingEntityService,
|
$FollowingEntityService,
|
||||||
$FollowRequestEntityService,
|
$FollowRequestEntityService,
|
||||||
$GalleryLikeEntityService,
|
$GalleryLikeEntityService,
|
||||||
|
|
|
@ -12,13 +12,13 @@ import { EmojiEntityService } from '@/core/entities/EmojiEntityService.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
import type { MiDriveFile } from '@/models/DriveFile.js';
|
import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||||
import type { MiEmoji } from '@/models/Emoji.js';
|
import type { MiEmoji } from '@/models/Emoji.js';
|
||||||
import type { EmojisRepository, EmojiDraftsRepository, MiRole, MiUser } from '@/models/_.js';
|
import type { EmojisRepository, EmojiRequestsRepository, MiRole, MiUser } from '@/models/_.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { MemoryKVCache, RedisSingleCache } from '@/misc/cache.js';
|
import { MemoryKVCache, RedisSingleCache } from '@/misc/cache.js';
|
||||||
import { UtilityService } from '@/core/UtilityService.js';
|
import { UtilityService } from '@/core/UtilityService.js';
|
||||||
import type { Serialized } from '@/types.js';
|
import type { Serialized } from '@/types.js';
|
||||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
import { MiEmojiDraft } from '@/models/EmojiDraft.js';
|
import { MiEmojiRequest } from '@/models/EmojiRequest.js';
|
||||||
|
|
||||||
const parseEmojiStrRegexp = /^(\w+)(?:@([\w.-]+))?$/;
|
const parseEmojiStrRegexp = /^(\w+)(?:@([\w.-]+))?$/;
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
@Inject(DI.emojisRepository)
|
@Inject(DI.emojisRepository)
|
||||||
private emojisRepository: EmojisRepository,
|
private emojisRepository: EmojisRepository,
|
||||||
|
|
||||||
@Inject(DI.emojiDraftsRepository)
|
@Inject(DI.emojiRequestsRepository)
|
||||||
private emojiDraftsRepository: EmojiDraftsRepository,
|
private emojiRequestsRepository: EmojiRequestsRepository,
|
||||||
|
|
||||||
private utilityService: UtilityService,
|
private utilityService: UtilityService,
|
||||||
private idService: IdService,
|
private idService: IdService,
|
||||||
|
@ -60,7 +60,7 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async draft(data: {
|
public async Request(data: {
|
||||||
driveFile: MiDriveFile;
|
driveFile: MiDriveFile;
|
||||||
name: string;
|
name: string;
|
||||||
category: string | null;
|
category: string | null;
|
||||||
|
@ -68,8 +68,8 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
license: string | null;
|
license: string | null;
|
||||||
isSensitive: boolean;
|
isSensitive: boolean;
|
||||||
localOnly: boolean;
|
localOnly: boolean;
|
||||||
}, me?: MiUser): Promise<MiEmojiDraft> {
|
}, me?: MiUser): Promise<MiEmojiRequest> {
|
||||||
const emoji = await this.emojiDraftsRepository.insert({
|
const emoji = await this.emojiRequestsRepository.insert({
|
||||||
id: this.idService.gen(),
|
id: this.idService.gen(),
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
name: data.name,
|
name: data.name,
|
||||||
|
@ -82,7 +82,7 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
isSensitive: data.isSensitive,
|
isSensitive: data.isSensitive,
|
||||||
localOnly: data.localOnly,
|
localOnly: data.localOnly,
|
||||||
fileId: data.driveFile.id,
|
fileId: data.driveFile.id,
|
||||||
}).then(x => this.emojiDraftsRepository.findOneByOrFail(x.identifiers[0]));
|
}).then(x => this.emojiRequestsRepository.findOneByOrFail(x.identifiers[0]));
|
||||||
|
|
||||||
if (me) {
|
if (me) {
|
||||||
this.moderationLogService.log(me, 'addCustomEmoji', {
|
this.moderationLogService.log(me, 'addCustomEmoji', {
|
||||||
|
@ -196,7 +196,7 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@bindThis
|
@bindThis
|
||||||
public async draftUpdate(id: MiEmoji['id'], data: {
|
public async RequestUpdate(id: MiEmoji['id'], data: {
|
||||||
driveFile?: MiDriveFile;
|
driveFile?: MiDriveFile;
|
||||||
name?: string;
|
name?: string;
|
||||||
category?: string | null;
|
category?: string | null;
|
||||||
|
@ -205,11 +205,11 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
isSensitive?: boolean;
|
isSensitive?: boolean;
|
||||||
localOnly?: boolean;
|
localOnly?: boolean;
|
||||||
}, moderator?: MiUser): Promise<void> {
|
}, moderator?: MiUser): Promise<void> {
|
||||||
const emoji = await this.emojiDraftsRepository.findOneByOrFail({ id: id });
|
const emoji = await this.emojiRequestsRepository.findOneByOrFail({ id: id });
|
||||||
const sameNameEmoji = await this.emojiDraftsRepository.findOneBy({ name: data.name });
|
const sameNameEmoji = await this.emojiRequestsRepository.findOneBy({ name: data.name });
|
||||||
if (sameNameEmoji != null && sameNameEmoji.id !== id) throw new Error('name already exists');
|
if (sameNameEmoji != null && sameNameEmoji.id !== id) throw new Error('name already exists');
|
||||||
|
|
||||||
await this.emojiDraftsRepository.update(emoji.id, {
|
await this.emojiRequestsRepository.update(emoji.id, {
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
name: data.name,
|
name: data.name,
|
||||||
category: data.category,
|
category: data.category,
|
||||||
|
@ -332,10 +332,10 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@bindThis
|
@bindThis
|
||||||
public async draftDelete(id: MiEmojiDraft['id']) {
|
public async RequestDelete(id: MiEmojiRequest['id']) {
|
||||||
const emoji = await this.emojiDraftsRepository.findOneByOrFail({ id: id });
|
const emoji = await this.emojiRequestsRepository.findOneByOrFail({ id: id });
|
||||||
|
|
||||||
await this.emojiDraftsRepository.delete(emoji.id);
|
await this.emojiRequestsRepository.delete(emoji.id);
|
||||||
}
|
}
|
||||||
@bindThis
|
@bindThis
|
||||||
public async deleteBulk(ids: MiEmoji['id'][], moderator?: MiUser) {
|
public async deleteBulk(ids: MiEmoji['id'][], moderator?: MiUser) {
|
||||||
|
@ -458,8 +458,8 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
return this.emojisRepository.exist({ where: { name, host: IsNull() } });
|
return this.emojisRepository.exist({ where: { name, host: IsNull() } });
|
||||||
}
|
}
|
||||||
@bindThis
|
@bindThis
|
||||||
public checkDraftDuplicate(name: string): Promise<boolean> {
|
public checkRequestDuplicate(name: string): Promise<boolean> {
|
||||||
return this.emojiDraftsRepository.exist({ where: { name } });
|
return this.emojiRequestsRepository.exist({ where: { name } });
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
|
@ -468,8 +468,8 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public getEmojiDraftById(id: string): Promise<MiEmojiDraft | null> {
|
public getEmojiRequestById(id: string): Promise<MiEmojiRequest | null> {
|
||||||
return this.emojiDraftsRepository.findOneBy({ id });
|
return this.emojiRequestsRepository.findOneBy({ id });
|
||||||
}
|
}
|
||||||
@bindThis
|
@bindThis
|
||||||
public dispose(): void {
|
public dispose(): void {
|
||||||
|
|
|
@ -5,24 +5,24 @@
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { EmojiDraftsRepository } from '@/models/_.js';
|
import type { EmojiRequestsRepository } from '@/models/_.js';
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { MiEmojiDraft } from '@/models/EmojiDraft.js';
|
import { MiEmojiRequest } from '@/models/EmojiRequest.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class EmojiDraftsEntityService {
|
export class EmojiRequestsEntityService {
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.emojiDraftsRepository)
|
@Inject(DI.emojiRequestsRepository)
|
||||||
private emojiDraftsRepository: EmojiDraftsRepository,
|
private emojiRequestsRepository: EmojiRequestsRepository,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async packSimple(
|
public async packSimple(
|
||||||
src: MiEmojiDraft['id'] | MiEmojiDraft,
|
src: MiEmojiRequest['id'] | MiEmojiRequest,
|
||||||
): Promise<Packed<'EmojiDraftSimple'>> {
|
): Promise<Packed<'EmojiRequestSimple'>> {
|
||||||
const emoji = typeof src === 'object' ? src : await this.emojiDraftsRepository.findOneByOrFail({ id: src });
|
const emoji = typeof src === 'object' ? src : await this.emojiRequestsRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
aliases: emoji.aliases,
|
aliases: emoji.aliases,
|
||||||
|
@ -43,9 +43,9 @@ export class EmojiDraftsEntityService {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async packDetailed(
|
public async packDetailed(
|
||||||
src: MiEmojiDraft['id'] | MiEmojiDraft,
|
src: MiEmojiRequest['id'] | MiEmojiRequest,
|
||||||
): Promise<Packed<'EmojiDraftDetailed'>> {
|
): Promise<Packed<'EmojiRequestDetailed'>> {
|
||||||
const emoji = typeof src === 'object' ? src : await this.emojiDraftsRepository.findOneByOrFail({ id: src });
|
const emoji = typeof src === 'object' ? src : await this.emojiRequestsRepository.findOneByOrFail({ id: src });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: emoji.id,
|
id: emoji.id,
|
|
@ -40,7 +40,7 @@ export const DI = {
|
||||||
followRequestsRepository: Symbol('followRequestsRepository'),
|
followRequestsRepository: Symbol('followRequestsRepository'),
|
||||||
instancesRepository: Symbol('instancesRepository'),
|
instancesRepository: Symbol('instancesRepository'),
|
||||||
emojisRepository: Symbol('emojisRepository'),
|
emojisRepository: Symbol('emojisRepository'),
|
||||||
emojiDraftsRepository: Symbol('emojiDraftsRepository'),
|
emojiRequestsRepository: Symbol('emojiRequestsRepository'),
|
||||||
driveFilesRepository: Symbol('driveFilesRepository'),
|
driveFilesRepository: Symbol('driveFilesRepository'),
|
||||||
driveFoldersRepository: Symbol('driveFoldersRepository'),
|
driveFoldersRepository: Symbol('driveFoldersRepository'),
|
||||||
metasRepository: Symbol('metasRepository'),
|
metasRepository: Symbol('metasRepository'),
|
||||||
|
|
|
@ -33,7 +33,7 @@ import { packedClipSchema } from '@/models/json-schema/clip.js';
|
||||||
import { packedFederationInstanceSchema } from '@/models/json-schema/federation-instance.js';
|
import { packedFederationInstanceSchema } from '@/models/json-schema/federation-instance.js';
|
||||||
import { packedQueueCountSchema } from '@/models/json-schema/queue.js';
|
import { packedQueueCountSchema } from '@/models/json-schema/queue.js';
|
||||||
import { packedGalleryPostSchema } from '@/models/json-schema/gallery-post.js';
|
import { packedGalleryPostSchema } from '@/models/json-schema/gallery-post.js';
|
||||||
import { packedEmojiDetailedSchema, packedEmojiDraftSimpleSchema, packedEmojiSimpleSchema, packedEmojiDraftDetailedSchema } from '@/models/json-schema/emoji.js';
|
import { packedEmojiDetailedSchema, packedEmojiRequestSimpleSchema, packedEmojiSimpleSchema, packedEmojiRequestDetailedSchema } from '@/models/json-schema/emoji.js';
|
||||||
import { packedFlashSchema } from '@/models/json-schema/flash.js';
|
import { packedFlashSchema } from '@/models/json-schema/flash.js';
|
||||||
import { packedAnnouncementSchema } from '@/models/json-schema/announcement.js';
|
import { packedAnnouncementSchema } from '@/models/json-schema/announcement.js';
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@ export const refs = {
|
||||||
FederationInstance: packedFederationInstanceSchema,
|
FederationInstance: packedFederationInstanceSchema,
|
||||||
GalleryPost: packedGalleryPostSchema,
|
GalleryPost: packedGalleryPostSchema,
|
||||||
EmojiSimple: packedEmojiSimpleSchema,
|
EmojiSimple: packedEmojiSimpleSchema,
|
||||||
EmojiDraftSimple: packedEmojiDraftSimpleSchema,
|
EmojiRequestSimple: packedEmojiRequestSimpleSchema,
|
||||||
EmojiDetailed: packedEmojiDetailedSchema,
|
EmojiDetailed: packedEmojiDetailedSchema,
|
||||||
EmojiDraftDetailed: packedEmojiDraftDetailedSchema,
|
EmojiRequestDetailed: packedEmojiRequestDetailedSchema,
|
||||||
Flash: packedFlashSchema,
|
Flash: packedFlashSchema,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
import { PrimaryColumn, Entity, Index, Column } from 'typeorm';
|
import { PrimaryColumn, Entity, Index, Column } from 'typeorm';
|
||||||
import { id } from './util/id.js';
|
import { id } from './util/id.js';
|
||||||
|
|
||||||
@Entity('emoji_draft')
|
@Entity('emoji_request')
|
||||||
@Index(['name'], { unique: true })
|
@Index(['name'], { unique: true })
|
||||||
export class MiEmojiDraft {
|
export class MiEmojiRequest {
|
||||||
@PrimaryColumn(id())
|
@PrimaryColumn(id())
|
||||||
public id: string;
|
public id: string;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { MiAbuseUserReport, MiAccessToken, MiAd, MiAnnouncement, MiAnnouncementRead, MiAntenna, MiApp, MiAuthSession, MiAvatarDecoration, MiBlocking, MiChannel, MiChannelFavorite, MiChannelFollowing, MiClip, MiClipFavorite, MiClipNote, MiDriveFile, MiDriveFolder, MiEmoji, MiEmojiDraft, MiFlash, MiFlashLike, MiFollowRequest, MiFollowing, MiGalleryLike, MiGalleryPost, MiHashtag, MiInstance, MiMeta, MiModerationLog, MiMuting, MiNote, MiNoteFavorite, MiNoteReaction, MiNoteThreadMuting, MiNoteUnread, MiPage, MiPageLike, MiPasswordResetRequest, MiPoll, MiPollVote, MiPromoNote, MiPromoRead, MiRegistrationTicket, MiRegistryItem, MiRelay, MiRenoteMuting, MiRetentionAggregation, MiRole, MiRoleAssignment, MiSignin, MiSwSubscription, MiUsedUsername, MiUser, MiUserIp, MiUserKeypair, MiUserList, MiUserListFavorite, MiUserListMembership, MiUserMemo, MiUserNotePining, MiUserPending, MiUserProfile, MiUserPublickey, MiUserSecurityKey, MiWebhook } from './_.js';
|
import { MiAbuseUserReport, MiAccessToken, MiAd, MiAnnouncement, MiAnnouncementRead, MiAntenna, MiApp, MiAuthSession, MiAvatarDecoration, MiBlocking, MiChannel, MiChannelFavorite, MiChannelFollowing, MiClip, MiClipFavorite, MiClipNote, MiDriveFile, MiDriveFolder, MiEmoji, MiEmojiRequest, MiFlash, MiFlashLike, MiFollowRequest, MiFollowing, MiGalleryLike, MiGalleryPost, MiHashtag, MiInstance, MiMeta, MiModerationLog, MiMuting, MiNote, MiNoteFavorite, MiNoteReaction, MiNoteThreadMuting, MiNoteUnread, MiPage, MiPageLike, MiPasswordResetRequest, MiPoll, MiPollVote, MiPromoNote, MiPromoRead, MiRegistrationTicket, MiRegistryItem, MiRelay, MiRenoteMuting, MiRetentionAggregation, MiRole, MiRoleAssignment, MiSignin, MiSwSubscription, MiUsedUsername, MiUser, MiUserIp, MiUserKeypair, MiUserList, MiUserListFavorite, MiUserListMembership, MiUserMemo, MiUserNotePining, MiUserPending, MiUserProfile, MiUserPublickey, MiUserSecurityKey, MiWebhook } from './_.js';
|
||||||
import type { DataSource } from 'typeorm';
|
import type { DataSource } from 'typeorm';
|
||||||
import type { Provider } from '@nestjs/common';
|
import type { Provider } from '@nestjs/common';
|
||||||
|
|
||||||
|
@ -171,9 +171,9 @@ const $emojisRepository: Provider = {
|
||||||
inject: [DI.db],
|
inject: [DI.db],
|
||||||
};
|
};
|
||||||
|
|
||||||
const $emojiDraftsRepository: Provider = {
|
const $emojiRequestsRepository: Provider = {
|
||||||
provide: DI.emojiDraftsRepository,
|
provide: DI.emojiRequestsRepository,
|
||||||
useFactory: (db: DataSource) => db.getRepository(MiEmojiDraft),
|
useFactory: (db: DataSource) => db.getRepository(MiEmojiRequest),
|
||||||
inject: [DI.db],
|
inject: [DI.db],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ const $userMemosRepository: Provider = {
|
||||||
$followRequestsRepository,
|
$followRequestsRepository,
|
||||||
$instancesRepository,
|
$instancesRepository,
|
||||||
$emojisRepository,
|
$emojisRepository,
|
||||||
$emojiDraftsRepository,
|
$emojiRequestsRepository,
|
||||||
$driveFilesRepository,
|
$driveFilesRepository,
|
||||||
$driveFoldersRepository,
|
$driveFoldersRepository,
|
||||||
$metasRepository,
|
$metasRepository,
|
||||||
|
@ -504,7 +504,7 @@ const $userMemosRepository: Provider = {
|
||||||
$followRequestsRepository,
|
$followRequestsRepository,
|
||||||
$instancesRepository,
|
$instancesRepository,
|
||||||
$emojisRepository,
|
$emojisRepository,
|
||||||
$emojiDraftsRepository,
|
$emojiRequestsRepository,
|
||||||
$driveFilesRepository,
|
$driveFilesRepository,
|
||||||
$driveFoldersRepository,
|
$driveFoldersRepository,
|
||||||
$metasRepository,
|
$metasRepository,
|
||||||
|
|
|
@ -21,6 +21,7 @@ import { MiClipFavorite } from '@/models/ClipFavorite.js';
|
||||||
import { MiDriveFile } from '@/models/DriveFile.js';
|
import { MiDriveFile } from '@/models/DriveFile.js';
|
||||||
import { MiDriveFolder } from '@/models/DriveFolder.js';
|
import { MiDriveFolder } from '@/models/DriveFolder.js';
|
||||||
import { MiEmoji } from '@/models/Emoji.js';
|
import { MiEmoji } from '@/models/Emoji.js';
|
||||||
|
import { MiEmojiRequest } from '@/models/EmojiRequest.js';
|
||||||
import { MiFollowing } from '@/models/Following.js';
|
import { MiFollowing } from '@/models/Following.js';
|
||||||
import { MiFollowRequest } from '@/models/FollowRequest.js';
|
import { MiFollowRequest } from '@/models/FollowRequest.js';
|
||||||
import { MiGalleryLike } from '@/models/GalleryLike.js';
|
import { MiGalleryLike } from '@/models/GalleryLike.js';
|
||||||
|
@ -68,7 +69,6 @@ import { MiRoleAssignment } from '@/models/RoleAssignment.js';
|
||||||
import { MiFlash } from '@/models/Flash.js';
|
import { MiFlash } from '@/models/Flash.js';
|
||||||
import { MiFlashLike } from '@/models/FlashLike.js';
|
import { MiFlashLike } from '@/models/FlashLike.js';
|
||||||
import { MiUserListFavorite } from '@/models/UserListFavorite.js';
|
import { MiUserListFavorite } from '@/models/UserListFavorite.js';
|
||||||
import { MiEmojiDraft } from '@/models/EmojiDraft.js';
|
|
||||||
import type { Repository } from 'typeorm';
|
import type { Repository } from 'typeorm';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
@ -90,7 +90,7 @@ export {
|
||||||
MiDriveFile,
|
MiDriveFile,
|
||||||
MiDriveFolder,
|
MiDriveFolder,
|
||||||
MiEmoji,
|
MiEmoji,
|
||||||
MiEmojiDraft,
|
MiEmojiRequest,
|
||||||
MiFollowing,
|
MiFollowing,
|
||||||
MiFollowRequest,
|
MiFollowRequest,
|
||||||
MiGalleryLike,
|
MiGalleryLike,
|
||||||
|
@ -158,7 +158,7 @@ export type ClipFavoritesRepository = Repository<MiClipFavorite>;
|
||||||
export type DriveFilesRepository = Repository<MiDriveFile>;
|
export type DriveFilesRepository = Repository<MiDriveFile>;
|
||||||
export type DriveFoldersRepository = Repository<MiDriveFolder>;
|
export type DriveFoldersRepository = Repository<MiDriveFolder>;
|
||||||
export type EmojisRepository = Repository<MiEmoji>;
|
export type EmojisRepository = Repository<MiEmoji>;
|
||||||
export type EmojiDraftsRepository = Repository<MiEmojiDraft>;
|
export type EmojiRequestsRepository = Repository<MiEmojiRequest>;
|
||||||
export type FollowingsRepository = Repository<MiFollowing>;
|
export type FollowingsRepository = Repository<MiFollowing>;
|
||||||
export type FollowRequestsRepository = Repository<MiFollowRequest>;
|
export type FollowRequestsRepository = Repository<MiFollowRequest>;
|
||||||
export type GalleryLikesRepository = Repository<MiGalleryLike>;
|
export type GalleryLikesRepository = Repository<MiGalleryLike>;
|
||||||
|
|
|
@ -42,7 +42,7 @@ export const packedEmojiSimpleSchema = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
export const packedEmojiDraftSimpleSchema = {
|
export const packedEmojiRequestSimpleSchema = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
aliases: {
|
aliases: {
|
||||||
|
@ -131,7 +131,7 @@ export const packedEmojiDetailedSchema = {
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const packedEmojiDraftDetailedSchema = {
|
export const packedEmojiRequestDetailedSchema = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
id: {
|
||||||
|
|
|
@ -29,7 +29,7 @@ import { MiClipFavorite } from '@/models/ClipFavorite.js';
|
||||||
import { MiDriveFile } from '@/models/DriveFile.js';
|
import { MiDriveFile } from '@/models/DriveFile.js';
|
||||||
import { MiDriveFolder } from '@/models/DriveFolder.js';
|
import { MiDriveFolder } from '@/models/DriveFolder.js';
|
||||||
import { MiEmoji } from '@/models/Emoji.js';
|
import { MiEmoji } from '@/models/Emoji.js';
|
||||||
import { MiEmojiDraft } from '@/models/EmojiDraft.js';
|
import { MiEmojiRequest } from '@/models/EmojiRequest.js';
|
||||||
import { MiFollowing } from '@/models/Following.js';
|
import { MiFollowing } from '@/models/Following.js';
|
||||||
import { MiFollowRequest } from '@/models/FollowRequest.js';
|
import { MiFollowRequest } from '@/models/FollowRequest.js';
|
||||||
import { MiGalleryLike } from '@/models/GalleryLike.js';
|
import { MiGalleryLike } from '@/models/GalleryLike.js';
|
||||||
|
@ -163,7 +163,7 @@ export const entities = [
|
||||||
MiPoll,
|
MiPoll,
|
||||||
MiPollVote,
|
MiPollVote,
|
||||||
MiEmoji,
|
MiEmoji,
|
||||||
MiEmojiDraft,
|
MiEmojiRequest,
|
||||||
MiHashtag,
|
MiHashtag,
|
||||||
MiSwSubscription,
|
MiSwSubscription,
|
||||||
MiAbuseUserReport,
|
MiAbuseUserReport,
|
||||||
|
|
|
@ -29,20 +29,20 @@ import * as ep___admin_drive_files from './endpoints/admin/drive/files.js';
|
||||||
import * as ep___admin_drive_showFile from './endpoints/admin/drive/show-file.js';
|
import * as ep___admin_drive_showFile from './endpoints/admin/drive/show-file.js';
|
||||||
import * as ep___admin_emoji_addAliasesBulk from './endpoints/admin/emoji/add-aliases-bulk.js';
|
import * as ep___admin_emoji_addAliasesBulk from './endpoints/admin/emoji/add-aliases-bulk.js';
|
||||||
import * as ep___admin_emoji_add from './endpoints/admin/emoji/add.js';
|
import * as ep___admin_emoji_add from './endpoints/admin/emoji/add.js';
|
||||||
import * as ep___admin_emoji_addDraft from './endpoints/admin/emoji/add-draft.js';
|
import * as ep___admin_emoji_addRequest from './endpoints/admin/emoji/add-request.js';
|
||||||
import * as ep___admin_emoji_copy from './endpoints/admin/emoji/copy.js';
|
import * as ep___admin_emoji_copy from './endpoints/admin/emoji/copy.js';
|
||||||
import * as ep___admin_emoji_deleteBulk from './endpoints/admin/emoji/delete-bulk.js';
|
import * as ep___admin_emoji_deleteBulk from './endpoints/admin/emoji/delete-bulk.js';
|
||||||
import * as ep___admin_emoji_delete from './endpoints/admin/emoji/delete.js';
|
import * as ep___admin_emoji_delete from './endpoints/admin/emoji/delete.js';
|
||||||
import * as ep___admin_emoji_importZip from './endpoints/admin/emoji/import-zip.js';
|
import * as ep___admin_emoji_importZip from './endpoints/admin/emoji/import-zip.js';
|
||||||
import * as ep___admin_emoji_listRemote from './endpoints/admin/emoji/list-remote.js';
|
import * as ep___admin_emoji_listRemote from './endpoints/admin/emoji/list-remote.js';
|
||||||
import * as ep___admin_emoji_list from './endpoints/admin/emoji/list.js';
|
import * as ep___admin_emoji_list from './endpoints/admin/emoji/list.js';
|
||||||
import * as ep___admin_emoji_listDraft from './endpoints/admin/emoji/list-draft.js';
|
import * as ep___admin_emoji_listRequest from './endpoints/admin/emoji/list-request.js';
|
||||||
import * as ep___admin_emoji_removeAliasesBulk from './endpoints/admin/emoji/remove-aliases-bulk.js';
|
import * as ep___admin_emoji_removeAliasesBulk from './endpoints/admin/emoji/remove-aliases-bulk.js';
|
||||||
import * as ep___admin_emoji_setAliasesBulk from './endpoints/admin/emoji/set-aliases-bulk.js';
|
import * as ep___admin_emoji_setAliasesBulk from './endpoints/admin/emoji/set-aliases-bulk.js';
|
||||||
import * as ep___admin_emoji_setCategoryBulk from './endpoints/admin/emoji/set-category-bulk.js';
|
import * as ep___admin_emoji_setCategoryBulk from './endpoints/admin/emoji/set-category-bulk.js';
|
||||||
import * as ep___admin_emoji_setLicenseBulk from './endpoints/admin/emoji/set-license-bulk.js';
|
import * as ep___admin_emoji_setLicenseBulk from './endpoints/admin/emoji/set-license-bulk.js';
|
||||||
import * as ep___admin_emoji_update from './endpoints/admin/emoji/update.js';
|
import * as ep___admin_emoji_update from './endpoints/admin/emoji/update.js';
|
||||||
import * as ep___admin_emoji_updateDraft from './endpoints/admin/emoji/update-draft.js';
|
import * as ep___admin_emoji_updateRequest from './endpoints/admin/emoji/update-request.js';
|
||||||
import * as ep___admin_federation_deleteAllFiles from './endpoints/admin/federation/delete-all-files.js';
|
import * as ep___admin_federation_deleteAllFiles from './endpoints/admin/federation/delete-all-files.js';
|
||||||
import * as ep___admin_federation_refreshRemoteInstanceMetadata from './endpoints/admin/federation/refresh-remote-instance-metadata.js';
|
import * as ep___admin_federation_refreshRemoteInstanceMetadata from './endpoints/admin/federation/refresh-remote-instance-metadata.js';
|
||||||
import * as ep___admin_federation_removeAllFollowing from './endpoints/admin/federation/remove-all-following.js';
|
import * as ep___admin_federation_removeAllFollowing from './endpoints/admin/federation/remove-all-following.js';
|
||||||
|
@ -251,7 +251,7 @@ import * as ep___invite_list from './endpoints/invite/list.js';
|
||||||
import * as ep___invite_limit from './endpoints/invite/limit.js';
|
import * as ep___invite_limit from './endpoints/invite/limit.js';
|
||||||
import * as ep___meta from './endpoints/meta.js';
|
import * as ep___meta from './endpoints/meta.js';
|
||||||
import * as ep___emojis from './endpoints/emojis.js';
|
import * as ep___emojis from './endpoints/emojis.js';
|
||||||
import * as ep___emojiDrafts from './endpoints/emoji-drafts.js';
|
import * as ep___emojiRequests from './endpoints/emoji-requests.js';
|
||||||
import * as ep___emoji from './endpoints/emoji.js';
|
import * as ep___emoji from './endpoints/emoji.js';
|
||||||
import * as ep___miauth_genToken from './endpoints/miauth/gen-token.js';
|
import * as ep___miauth_genToken from './endpoints/miauth/gen-token.js';
|
||||||
import * as ep___mute_create from './endpoints/mute/create.js';
|
import * as ep___mute_create from './endpoints/mute/create.js';
|
||||||
|
@ -390,20 +390,20 @@ const $admin_drive_files: Provider = { provide: 'ep:admin/drive/files', useClass
|
||||||
const $admin_drive_showFile: Provider = { provide: 'ep:admin/drive/show-file', useClass: ep___admin_drive_showFile.default };
|
const $admin_drive_showFile: Provider = { provide: 'ep:admin/drive/show-file', useClass: ep___admin_drive_showFile.default };
|
||||||
const $admin_emoji_addAliasesBulk: Provider = { provide: 'ep:admin/emoji/add-aliases-bulk', useClass: ep___admin_emoji_addAliasesBulk.default };
|
const $admin_emoji_addAliasesBulk: Provider = { provide: 'ep:admin/emoji/add-aliases-bulk', useClass: ep___admin_emoji_addAliasesBulk.default };
|
||||||
const $admin_emoji_add: Provider = { provide: 'ep:admin/emoji/add', useClass: ep___admin_emoji_add.default };
|
const $admin_emoji_add: Provider = { provide: 'ep:admin/emoji/add', useClass: ep___admin_emoji_add.default };
|
||||||
const $admin_emoji_addDraft: Provider = { provide: 'ep:admin/emoji/add-draft', useClass: ep___admin_emoji_addDraft.default };
|
const $admin_emoji_addRequest: Provider = { provide: 'ep:admin/emoji/add-request', useClass: ep___admin_emoji_addRequest.default };
|
||||||
const $admin_emoji_copy: Provider = { provide: 'ep:admin/emoji/copy', useClass: ep___admin_emoji_copy.default };
|
const $admin_emoji_copy: Provider = { provide: 'ep:admin/emoji/copy', useClass: ep___admin_emoji_copy.default };
|
||||||
const $admin_emoji_deleteBulk: Provider = { provide: 'ep:admin/emoji/delete-bulk', useClass: ep___admin_emoji_deleteBulk.default };
|
const $admin_emoji_deleteBulk: Provider = { provide: 'ep:admin/emoji/delete-bulk', useClass: ep___admin_emoji_deleteBulk.default };
|
||||||
const $admin_emoji_delete: Provider = { provide: 'ep:admin/emoji/delete', useClass: ep___admin_emoji_delete.default };
|
const $admin_emoji_delete: Provider = { provide: 'ep:admin/emoji/delete', useClass: ep___admin_emoji_delete.default };
|
||||||
const $admin_emoji_importZip: Provider = { provide: 'ep:admin/emoji/import-zip', useClass: ep___admin_emoji_importZip.default };
|
const $admin_emoji_importZip: Provider = { provide: 'ep:admin/emoji/import-zip', useClass: ep___admin_emoji_importZip.default };
|
||||||
const $admin_emoji_listRemote: Provider = { provide: 'ep:admin/emoji/list-remote', useClass: ep___admin_emoji_listRemote.default };
|
const $admin_emoji_listRemote: Provider = { provide: 'ep:admin/emoji/list-remote', useClass: ep___admin_emoji_listRemote.default };
|
||||||
const $admin_emoji_list: Provider = { provide: 'ep:admin/emoji/list', useClass: ep___admin_emoji_list.default };
|
const $admin_emoji_list: Provider = { provide: 'ep:admin/emoji/list', useClass: ep___admin_emoji_list.default };
|
||||||
const $admin_emoji_listDraft: Provider = { provide: 'ep:admin/emoji/list-draft', useClass: ep___admin_emoji_listDraft.default };
|
const $admin_emoji_listRequest: Provider = { provide: 'ep:admin/emoji/list-request', useClass: ep___admin_emoji_listRequest.default };
|
||||||
const $admin_emoji_removeAliasesBulk: Provider = { provide: 'ep:admin/emoji/remove-aliases-bulk', useClass: ep___admin_emoji_removeAliasesBulk.default };
|
const $admin_emoji_removeAliasesBulk: Provider = { provide: 'ep:admin/emoji/remove-aliases-bulk', useClass: ep___admin_emoji_removeAliasesBulk.default };
|
||||||
const $admin_emoji_setAliasesBulk: Provider = { provide: 'ep:admin/emoji/set-aliases-bulk', useClass: ep___admin_emoji_setAliasesBulk.default };
|
const $admin_emoji_setAliasesBulk: Provider = { provide: 'ep:admin/emoji/set-aliases-bulk', useClass: ep___admin_emoji_setAliasesBulk.default };
|
||||||
const $admin_emoji_setCategoryBulk: Provider = { provide: 'ep:admin/emoji/set-category-bulk', useClass: ep___admin_emoji_setCategoryBulk.default };
|
const $admin_emoji_setCategoryBulk: Provider = { provide: 'ep:admin/emoji/set-category-bulk', useClass: ep___admin_emoji_setCategoryBulk.default };
|
||||||
const $admin_emoji_setLicenseBulk: Provider = { provide: 'ep:admin/emoji/set-license-bulk', useClass: ep___admin_emoji_setLicenseBulk.default };
|
const $admin_emoji_setLicenseBulk: Provider = { provide: 'ep:admin/emoji/set-license-bulk', useClass: ep___admin_emoji_setLicenseBulk.default };
|
||||||
const $admin_emoji_update: Provider = { provide: 'ep:admin/emoji/update', useClass: ep___admin_emoji_update.default };
|
const $admin_emoji_update: Provider = { provide: 'ep:admin/emoji/update', useClass: ep___admin_emoji_update.default };
|
||||||
const $admin_emoji_updateDraft: Provider = { provide: 'ep:admin/emoji/update-draft', useClass: ep___admin_emoji_updateDraft.default };
|
const $admin_emoji_updateRequest: Provider = { provide: 'ep:admin/emoji/update-request', useClass: ep___admin_emoji_updateRequest.default };
|
||||||
const $admin_federation_deleteAllFiles: Provider = { provide: 'ep:admin/federation/delete-all-files', useClass: ep___admin_federation_deleteAllFiles.default };
|
const $admin_federation_deleteAllFiles: Provider = { provide: 'ep:admin/federation/delete-all-files', useClass: ep___admin_federation_deleteAllFiles.default };
|
||||||
const $admin_federation_refreshRemoteInstanceMetadata: Provider = { provide: 'ep:admin/federation/refresh-remote-instance-metadata', useClass: ep___admin_federation_refreshRemoteInstanceMetadata.default };
|
const $admin_federation_refreshRemoteInstanceMetadata: Provider = { provide: 'ep:admin/federation/refresh-remote-instance-metadata', useClass: ep___admin_federation_refreshRemoteInstanceMetadata.default };
|
||||||
const $admin_federation_removeAllFollowing: Provider = { provide: 'ep:admin/federation/remove-all-following', useClass: ep___admin_federation_removeAllFollowing.default };
|
const $admin_federation_removeAllFollowing: Provider = { provide: 'ep:admin/federation/remove-all-following', useClass: ep___admin_federation_removeAllFollowing.default };
|
||||||
|
@ -612,7 +612,7 @@ const $invite_list: Provider = { provide: 'ep:invite/list', useClass: ep___invit
|
||||||
const $invite_limit: Provider = { provide: 'ep:invite/limit', useClass: ep___invite_limit.default };
|
const $invite_limit: Provider = { provide: 'ep:invite/limit', useClass: ep___invite_limit.default };
|
||||||
const $meta: Provider = { provide: 'ep:meta', useClass: ep___meta.default };
|
const $meta: Provider = { provide: 'ep:meta', useClass: ep___meta.default };
|
||||||
const $emojis: Provider = { provide: 'ep:emojis', useClass: ep___emojis.default };
|
const $emojis: Provider = { provide: 'ep:emojis', useClass: ep___emojis.default };
|
||||||
const $emoji_drafts: Provider = { provide: 'ep:emoji-drafts', useClass: ep___emojiDrafts.default };
|
const $emoji_requests: Provider = { provide: 'ep:emoji-requests', useClass: ep___emojiRequests.default };
|
||||||
const $emoji: Provider = { provide: 'ep:emoji', useClass: ep___emoji.default };
|
const $emoji: Provider = { provide: 'ep:emoji', useClass: ep___emoji.default };
|
||||||
const $miauth_genToken: Provider = { provide: 'ep:miauth/gen-token', useClass: ep___miauth_genToken.default };
|
const $miauth_genToken: Provider = { provide: 'ep:miauth/gen-token', useClass: ep___miauth_genToken.default };
|
||||||
const $mute_create: Provider = { provide: 'ep:mute/create', useClass: ep___mute_create.default };
|
const $mute_create: Provider = { provide: 'ep:mute/create', useClass: ep___mute_create.default };
|
||||||
|
@ -755,20 +755,20 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
||||||
$admin_drive_showFile,
|
$admin_drive_showFile,
|
||||||
$admin_emoji_addAliasesBulk,
|
$admin_emoji_addAliasesBulk,
|
||||||
$admin_emoji_add,
|
$admin_emoji_add,
|
||||||
$admin_emoji_addDraft,
|
$admin_emoji_addRequest,
|
||||||
$admin_emoji_copy,
|
$admin_emoji_copy,
|
||||||
$admin_emoji_deleteBulk,
|
$admin_emoji_deleteBulk,
|
||||||
$admin_emoji_delete,
|
$admin_emoji_delete,
|
||||||
$admin_emoji_importZip,
|
$admin_emoji_importZip,
|
||||||
$admin_emoji_listRemote,
|
$admin_emoji_listRemote,
|
||||||
$admin_emoji_list,
|
$admin_emoji_list,
|
||||||
$admin_emoji_listDraft,
|
$admin_emoji_listRequest,
|
||||||
$admin_emoji_removeAliasesBulk,
|
$admin_emoji_removeAliasesBulk,
|
||||||
$admin_emoji_setAliasesBulk,
|
$admin_emoji_setAliasesBulk,
|
||||||
$admin_emoji_setCategoryBulk,
|
$admin_emoji_setCategoryBulk,
|
||||||
$admin_emoji_setLicenseBulk,
|
$admin_emoji_setLicenseBulk,
|
||||||
$admin_emoji_update,
|
$admin_emoji_update,
|
||||||
$admin_emoji_updateDraft,
|
$admin_emoji_updateRequest,
|
||||||
$admin_federation_deleteAllFiles,
|
$admin_federation_deleteAllFiles,
|
||||||
$admin_federation_refreshRemoteInstanceMetadata,
|
$admin_federation_refreshRemoteInstanceMetadata,
|
||||||
$admin_federation_removeAllFollowing,
|
$admin_federation_removeAllFollowing,
|
||||||
|
@ -977,7 +977,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
||||||
$invite_limit,
|
$invite_limit,
|
||||||
$meta,
|
$meta,
|
||||||
$emojis,
|
$emojis,
|
||||||
$emoji_drafts,
|
$emoji_requests,
|
||||||
$emoji,
|
$emoji,
|
||||||
$miauth_genToken,
|
$miauth_genToken,
|
||||||
$mute_create,
|
$mute_create,
|
||||||
|
@ -1114,20 +1114,20 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
||||||
$admin_drive_showFile,
|
$admin_drive_showFile,
|
||||||
$admin_emoji_addAliasesBulk,
|
$admin_emoji_addAliasesBulk,
|
||||||
$admin_emoji_add,
|
$admin_emoji_add,
|
||||||
$admin_emoji_addDraft,
|
$admin_emoji_addRequest,
|
||||||
$admin_emoji_copy,
|
$admin_emoji_copy,
|
||||||
$admin_emoji_deleteBulk,
|
$admin_emoji_deleteBulk,
|
||||||
$admin_emoji_delete,
|
$admin_emoji_delete,
|
||||||
$admin_emoji_importZip,
|
$admin_emoji_importZip,
|
||||||
$admin_emoji_listRemote,
|
$admin_emoji_listRemote,
|
||||||
$admin_emoji_list,
|
$admin_emoji_list,
|
||||||
$admin_emoji_listDraft,
|
$admin_emoji_listRequest,
|
||||||
$admin_emoji_removeAliasesBulk,
|
$admin_emoji_removeAliasesBulk,
|
||||||
$admin_emoji_setAliasesBulk,
|
$admin_emoji_setAliasesBulk,
|
||||||
$admin_emoji_setCategoryBulk,
|
$admin_emoji_setCategoryBulk,
|
||||||
$admin_emoji_setLicenseBulk,
|
$admin_emoji_setLicenseBulk,
|
||||||
$admin_emoji_update,
|
$admin_emoji_update,
|
||||||
$admin_emoji_updateDraft,
|
$admin_emoji_updateRequest,
|
||||||
$admin_federation_deleteAllFiles,
|
$admin_federation_deleteAllFiles,
|
||||||
$admin_federation_refreshRemoteInstanceMetadata,
|
$admin_federation_refreshRemoteInstanceMetadata,
|
||||||
$admin_federation_removeAllFollowing,
|
$admin_federation_removeAllFollowing,
|
||||||
|
@ -1336,7 +1336,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
||||||
$invite_limit,
|
$invite_limit,
|
||||||
$meta,
|
$meta,
|
||||||
$emojis,
|
$emojis,
|
||||||
$emoji_drafts,
|
$emoji_requests,
|
||||||
$emoji,
|
$emoji,
|
||||||
$miauth_genToken,
|
$miauth_genToken,
|
||||||
$mute_create,
|
$mute_create,
|
||||||
|
|
|
@ -29,20 +29,20 @@ import * as ep___admin_drive_files from './endpoints/admin/drive/files.js';
|
||||||
import * as ep___admin_drive_showFile from './endpoints/admin/drive/show-file.js';
|
import * as ep___admin_drive_showFile from './endpoints/admin/drive/show-file.js';
|
||||||
import * as ep___admin_emoji_addAliasesBulk from './endpoints/admin/emoji/add-aliases-bulk.js';
|
import * as ep___admin_emoji_addAliasesBulk from './endpoints/admin/emoji/add-aliases-bulk.js';
|
||||||
import * as ep___admin_emoji_add from './endpoints/admin/emoji/add.js';
|
import * as ep___admin_emoji_add from './endpoints/admin/emoji/add.js';
|
||||||
import * as ep___admin_emoji_addDraft from './endpoints/admin/emoji/add-draft.js';
|
import * as ep___admin_emoji_addRequest from './endpoints/admin/emoji/add-request.js';
|
||||||
import * as ep___admin_emoji_copy from './endpoints/admin/emoji/copy.js';
|
import * as ep___admin_emoji_copy from './endpoints/admin/emoji/copy.js';
|
||||||
import * as ep___admin_emoji_deleteBulk from './endpoints/admin/emoji/delete-bulk.js';
|
import * as ep___admin_emoji_deleteBulk from './endpoints/admin/emoji/delete-bulk.js';
|
||||||
import * as ep___admin_emoji_delete from './endpoints/admin/emoji/delete.js';
|
import * as ep___admin_emoji_delete from './endpoints/admin/emoji/delete.js';
|
||||||
import * as ep___admin_emoji_importZip from './endpoints/admin/emoji/import-zip.js';
|
import * as ep___admin_emoji_importZip from './endpoints/admin/emoji/import-zip.js';
|
||||||
import * as ep___admin_emoji_listRemote from './endpoints/admin/emoji/list-remote.js';
|
import * as ep___admin_emoji_listRemote from './endpoints/admin/emoji/list-remote.js';
|
||||||
import * as ep___admin_emoji_list from './endpoints/admin/emoji/list.js';
|
import * as ep___admin_emoji_list from './endpoints/admin/emoji/list.js';
|
||||||
import * as ep___admin_emoji_listDraft from './endpoints/admin/emoji/list-draft.js';
|
import * as ep___admin_emoji_listRequest from './endpoints/admin/emoji/list-request.js';
|
||||||
import * as ep___admin_emoji_removeAliasesBulk from './endpoints/admin/emoji/remove-aliases-bulk.js';
|
import * as ep___admin_emoji_removeAliasesBulk from './endpoints/admin/emoji/remove-aliases-bulk.js';
|
||||||
import * as ep___admin_emoji_setAliasesBulk from './endpoints/admin/emoji/set-aliases-bulk.js';
|
import * as ep___admin_emoji_setAliasesBulk from './endpoints/admin/emoji/set-aliases-bulk.js';
|
||||||
import * as ep___admin_emoji_setCategoryBulk from './endpoints/admin/emoji/set-category-bulk.js';
|
import * as ep___admin_emoji_setCategoryBulk from './endpoints/admin/emoji/set-category-bulk.js';
|
||||||
import * as ep___admin_emoji_setLicenseBulk from './endpoints/admin/emoji/set-license-bulk.js';
|
import * as ep___admin_emoji_setLicenseBulk from './endpoints/admin/emoji/set-license-bulk.js';
|
||||||
import * as ep___admin_emoji_update from './endpoints/admin/emoji/update.js';
|
import * as ep___admin_emoji_update from './endpoints/admin/emoji/update.js';
|
||||||
import * as ep___admin_emoji_updateDraft from './endpoints/admin/emoji/update-draft.js';
|
import * as ep___admin_emoji_updateRequest from './endpoints/admin/emoji/update-request.js';
|
||||||
import * as ep___admin_federation_deleteAllFiles from './endpoints/admin/federation/delete-all-files.js';
|
import * as ep___admin_federation_deleteAllFiles from './endpoints/admin/federation/delete-all-files.js';
|
||||||
import * as ep___admin_federation_refreshRemoteInstanceMetadata from './endpoints/admin/federation/refresh-remote-instance-metadata.js';
|
import * as ep___admin_federation_refreshRemoteInstanceMetadata from './endpoints/admin/federation/refresh-remote-instance-metadata.js';
|
||||||
import * as ep___admin_federation_removeAllFollowing from './endpoints/admin/federation/remove-all-following.js';
|
import * as ep___admin_federation_removeAllFollowing from './endpoints/admin/federation/remove-all-following.js';
|
||||||
|
@ -251,7 +251,7 @@ import * as ep___invite_list from './endpoints/invite/list.js';
|
||||||
import * as ep___invite_limit from './endpoints/invite/limit.js';
|
import * as ep___invite_limit from './endpoints/invite/limit.js';
|
||||||
import * as ep___meta from './endpoints/meta.js';
|
import * as ep___meta from './endpoints/meta.js';
|
||||||
import * as ep___emojis from './endpoints/emojis.js';
|
import * as ep___emojis from './endpoints/emojis.js';
|
||||||
import * as ep___emojiDrafts from './endpoints/emoji-drafts.js';
|
import * as ep___emojiRequests from './endpoints/emoji-requests.js';
|
||||||
import * as ep___emoji from './endpoints/emoji.js';
|
import * as ep___emoji from './endpoints/emoji.js';
|
||||||
import * as ep___miauth_genToken from './endpoints/miauth/gen-token.js';
|
import * as ep___miauth_genToken from './endpoints/miauth/gen-token.js';
|
||||||
import * as ep___mute_create from './endpoints/mute/create.js';
|
import * as ep___mute_create from './endpoints/mute/create.js';
|
||||||
|
@ -388,20 +388,20 @@ const eps = [
|
||||||
['admin/drive/show-file', ep___admin_drive_showFile],
|
['admin/drive/show-file', ep___admin_drive_showFile],
|
||||||
['admin/emoji/add-aliases-bulk', ep___admin_emoji_addAliasesBulk],
|
['admin/emoji/add-aliases-bulk', ep___admin_emoji_addAliasesBulk],
|
||||||
['admin/emoji/add', ep___admin_emoji_add],
|
['admin/emoji/add', ep___admin_emoji_add],
|
||||||
['admin/emoji/add-draft', ep___admin_emoji_addDraft],
|
['admin/emoji/add-request', ep___admin_emoji_addRequest],
|
||||||
['admin/emoji/copy', ep___admin_emoji_copy],
|
['admin/emoji/copy', ep___admin_emoji_copy],
|
||||||
['admin/emoji/delete-bulk', ep___admin_emoji_deleteBulk],
|
['admin/emoji/delete-bulk', ep___admin_emoji_deleteBulk],
|
||||||
['admin/emoji/delete', ep___admin_emoji_delete],
|
['admin/emoji/delete', ep___admin_emoji_delete],
|
||||||
['admin/emoji/import-zip', ep___admin_emoji_importZip],
|
['admin/emoji/import-zip', ep___admin_emoji_importZip],
|
||||||
['admin/emoji/list-remote', ep___admin_emoji_listRemote],
|
['admin/emoji/list-remote', ep___admin_emoji_listRemote],
|
||||||
['admin/emoji/list-draft', ep___admin_emoji_listDraft],
|
|
||||||
['admin/emoji/list', ep___admin_emoji_list],
|
['admin/emoji/list', ep___admin_emoji_list],
|
||||||
|
['admin/emoji/list-request', ep___admin_emoji_listRequest],
|
||||||
['admin/emoji/remove-aliases-bulk', ep___admin_emoji_removeAliasesBulk],
|
['admin/emoji/remove-aliases-bulk', ep___admin_emoji_removeAliasesBulk],
|
||||||
['admin/emoji/set-aliases-bulk', ep___admin_emoji_setAliasesBulk],
|
['admin/emoji/set-aliases-bulk', ep___admin_emoji_setAliasesBulk],
|
||||||
['admin/emoji/set-category-bulk', ep___admin_emoji_setCategoryBulk],
|
['admin/emoji/set-category-bulk', ep___admin_emoji_setCategoryBulk],
|
||||||
['admin/emoji/set-license-bulk', ep___admin_emoji_setLicenseBulk],
|
['admin/emoji/set-license-bulk', ep___admin_emoji_setLicenseBulk],
|
||||||
['admin/emoji/update', ep___admin_emoji_update],
|
['admin/emoji/update', ep___admin_emoji_update],
|
||||||
['admin/emoji/update-draft', ep___admin_emoji_updateDraft],
|
['admin/emoji/update-request', ep___admin_emoji_updateRequest],
|
||||||
['admin/federation/delete-all-files', ep___admin_federation_deleteAllFiles],
|
['admin/federation/delete-all-files', ep___admin_federation_deleteAllFiles],
|
||||||
['admin/federation/refresh-remote-instance-metadata', ep___admin_federation_refreshRemoteInstanceMetadata],
|
['admin/federation/refresh-remote-instance-metadata', ep___admin_federation_refreshRemoteInstanceMetadata],
|
||||||
['admin/federation/remove-all-following', ep___admin_federation_removeAllFollowing],
|
['admin/federation/remove-all-following', ep___admin_federation_removeAllFollowing],
|
||||||
|
@ -610,7 +610,7 @@ const eps = [
|
||||||
['invite/limit', ep___invite_limit],
|
['invite/limit', ep___invite_limit],
|
||||||
['meta', ep___meta],
|
['meta', ep___meta],
|
||||||
['emojis', ep___emojis],
|
['emojis', ep___emojis],
|
||||||
['emoji-drafts', ep___emojiDrafts],
|
['emoji-requests', ep___emojiRequests],
|
||||||
['emoji', ep___emoji],
|
['emoji', ep___emoji],
|
||||||
['miauth/gen-token', ep___miauth_genToken],
|
['miauth/gen-token', ep___miauth_genToken],
|
||||||
['mute/create', ep___mute_create],
|
['mute/create', ep___mute_create],
|
||||||
|
|
|
@ -61,14 +61,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const isDuplicate = await this.customEmojiService.checkDuplicate(ps.name);
|
const isDuplicate = await this.customEmojiService.checkDuplicate(ps.name);
|
||||||
const isDraftDuplicate = await this.customEmojiService.checkDraftDuplicate(ps.name);
|
const isRequestDuplicate = await this.customEmojiService.checkRequestDuplicate(ps.name);
|
||||||
|
|
||||||
if (isDuplicate || isDraftDuplicate) throw new ApiError(meta.errors.duplicateName);
|
if (isDuplicate || isRequestDuplicate) throw new ApiError(meta.errors.duplicateName);
|
||||||
const driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
|
const driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
|
||||||
|
|
||||||
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
|
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
|
||||||
|
|
||||||
const emoji = await this.customEmojiService.draft({
|
const emoji = await this.customEmojiService.Request({
|
||||||
driveFile,
|
driveFile,
|
||||||
name: ps.name,
|
name: ps.name,
|
||||||
category: ps.category ?? null,
|
category: ps.category ?? null,
|
|
@ -37,12 +37,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const emoji = await this.customEmojiService.getEmojiById(ps.id);
|
const emoji = await this.customEmojiService.getEmojiById(ps.id);
|
||||||
const draftEmoji = await this.customEmojiService.getEmojiDraftById(ps.id);
|
const RequestEmoji = await this.customEmojiService.getEmojiRequestById(ps.id);
|
||||||
if (emoji != null) {
|
if (emoji != null) {
|
||||||
await this.customEmojiService.delete(ps.id, me);
|
await this.customEmojiService.delete(ps.id, me);
|
||||||
}
|
}
|
||||||
if (draftEmoji != null) {
|
if (RequestEmoji != null) {
|
||||||
await this.customEmojiService.draftDelete(ps.id);
|
await this.customEmojiService.RequestDelete(ps.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import type { EmojiDraftsRepository } from '@/models/_.js';
|
import type { EmojiRequestsRepository } from '@/models/_.js';
|
||||||
import type { MiEmojiDraft } from '@/models/EmojiDraft.js';
|
import type { MiEmojiRequest } from '@/models/EmojiRequest.js';
|
||||||
import { QueryService } from '@/core/QueryService.js';
|
import { QueryService } from '@/core/QueryService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { EmojiDraftsEntityService } from '@/core/entities/EmojiDraftsEntityService.js';
|
import { EmojiRequestsEntityService } from '@/core/entities/EmojiRequestsEntityService.js';
|
||||||
//import { sqlLikeEscape } from '@/misc/sql-like-escape.js';
|
//import { sqlLikeEscape } from '@/misc/sql-like-escape.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
@ -69,16 +69,16 @@ export const paramDef = {
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.emojiDraftsRepository)
|
@Inject(DI.emojiRequestsRepository)
|
||||||
private emojiDraftsRepository: EmojiDraftsRepository,
|
private emojiRequestsRepository: EmojiRequestsRepository,
|
||||||
|
|
||||||
private emojiDraftsEntityService: EmojiDraftsEntityService,
|
private emojiRequestsEntityService: EmojiRequestsEntityService,
|
||||||
private queryService: QueryService,
|
private queryService: QueryService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const q = this.queryService.makePaginationQuery(this.emojiDraftsRepository.createQueryBuilder('emoji'), ps.sinceId, ps.untilId);
|
const q = this.queryService.makePaginationQuery(this.emojiRequestsRepository.createQueryBuilder('emoji'), ps.sinceId, ps.untilId);
|
||||||
|
|
||||||
let emojis: MiEmojiDraft[];
|
let emojis: MiEmojiRequest[];
|
||||||
|
|
||||||
if (ps.query) {
|
if (ps.query) {
|
||||||
//q.andWhere('emoji.name ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` });
|
//q.andWhere('emoji.name ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` });
|
||||||
|
@ -102,7 +102,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
emojis = await q.limit(ps.limit).getMany();
|
emojis = await q.limit(ps.limit).getMany();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.emojiDraftsEntityService.packDetailedMany(emojis);
|
return this.emojiRequestsEntityService.packDetailedMany(emojis);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -56,7 +56,7 @@ export const paramDef = {
|
||||||
roleIdsThatCanBeUsedThisEmojiAsReaction: { type: 'array', items: {
|
roleIdsThatCanBeUsedThisEmojiAsReaction: { type: 'array', items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
} },
|
} },
|
||||||
draft: { type: 'boolean' },
|
Request: { type: 'boolean' },
|
||||||
},
|
},
|
||||||
required: ['id', 'name', 'aliases'],
|
required: ['id', 'name', 'aliases'],
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -72,22 +72,22 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
let driveFile;
|
let driveFile;
|
||||||
const isDraft = !!ps.draft;
|
const isRequest = !!ps.Request;
|
||||||
if (ps.fileId) {
|
if (ps.fileId) {
|
||||||
driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
|
driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
|
||||||
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
|
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
const emoji = await this.customEmojiService.getEmojiDraftById(ps.id);
|
const emoji = await this.customEmojiService.getEmojiRequestById(ps.id);
|
||||||
if (emoji != null) {
|
if (emoji != null) {
|
||||||
if (ps.name !== emoji.name) {
|
if (ps.name !== emoji.name) {
|
||||||
const isDuplicate = await this.customEmojiService.checkDraftDuplicate(ps.name);
|
const isDuplicate = await this.customEmojiService.checkRequestDuplicate(ps.name);
|
||||||
if (isDuplicate) throw new ApiError(meta.errors.sameNameEmojiExists);
|
if (isDuplicate) throw new ApiError(meta.errors.sameNameEmojiExists);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new ApiError(meta.errors.noSuchEmoji);
|
throw new ApiError(meta.errors.noSuchEmoji);
|
||||||
}
|
}
|
||||||
if (!isDraft) {
|
if (!isRequest) {
|
||||||
const file = await this.driveFileEntityService.getFromUrl(emoji.originalUrl);
|
const file = await this.driveFileEntityService.getFromUrl(emoji.originalUrl);
|
||||||
if (file === null) throw new ApiError(meta.errors.noSuchFile);
|
if (file === null) throw new ApiError(meta.errors.noSuchFile);
|
||||||
await this.customEmojiService.add({
|
await this.customEmojiService.add({
|
||||||
|
@ -101,9 +101,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
localOnly: ps.localOnly ?? false,
|
localOnly: ps.localOnly ?? false,
|
||||||
roleIdsThatCanBeUsedThisEmojiAsReaction: [],
|
roleIdsThatCanBeUsedThisEmojiAsReaction: [],
|
||||||
}, me);
|
}, me);
|
||||||
await this.customEmojiService.draftDelete(ps.id);
|
await this.customEmojiService.RequestDelete(ps.id);
|
||||||
} else {
|
} else {
|
||||||
await this.customEmojiService.draftUpdate(ps.id, {
|
await this.customEmojiService.RequestUpdate(ps.id, {
|
||||||
name: ps.name,
|
name: ps.name,
|
||||||
category: ps.category ?? null,
|
category: ps.category ?? null,
|
||||||
aliases: ps.aliases ?? [],
|
aliases: ps.aliases ?? [],
|
|
@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
||||||
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||||
import type { DriveFilesRepository, EmojiDraftsRepository } from '@/models/_.js';
|
import type { DriveFilesRepository } from '@/models/_.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { ApiError } from '../../../error.js';
|
import { ApiError } from '../../../error.js';
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ export const paramDef = {
|
||||||
roleIdsThatCanBeUsedThisEmojiAsReaction: { type: 'array', items: {
|
roleIdsThatCanBeUsedThisEmojiAsReaction: { type: 'array', items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
} },
|
} },
|
||||||
draft: { type: 'boolean' },
|
Request: { type: 'boolean' },
|
||||||
},
|
},
|
||||||
required: ['id', 'name', 'aliases'],
|
required: ['id', 'name', 'aliases'],
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -72,7 +72,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
let driveFile;
|
let driveFile;
|
||||||
const isDraft = !!ps.draft;
|
const isRequest = !!ps.Request;
|
||||||
if (ps.fileId) {
|
if (ps.fileId) {
|
||||||
driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
|
driveFile = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
|
||||||
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
|
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
|
||||||
|
@ -87,7 +87,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw new ApiError(meta.errors.noSuchEmoji);
|
throw new ApiError(meta.errors.noSuchEmoji);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDraft) {
|
if (!isRequest) {
|
||||||
await this.customEmojiService.update(ps.id, {
|
await this.customEmojiService.update(ps.id, {
|
||||||
driveFile,
|
driveFile,
|
||||||
name: ps.name,
|
name: ps.name,
|
||||||
|
@ -101,7 +101,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
} else {
|
} else {
|
||||||
const file = await this.driveFileEntityService.getFromUrl(emoji.originalUrl);
|
const file = await this.driveFileEntityService.getFromUrl(emoji.originalUrl);
|
||||||
if (file === null) throw new ApiError(meta.errors.noSuchFile);
|
if (file === null) throw new ApiError(meta.errors.noSuchFile);
|
||||||
await this.customEmojiService.draft({
|
await this.customEmojiService.Request({
|
||||||
driveFile: file,
|
driveFile: file,
|
||||||
name: ps.name,
|
name: ps.name,
|
||||||
category: ps.category ?? null,
|
category: ps.category ?? null,
|
||||||
|
|
|
@ -3,11 +3,10 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IsNull } from 'typeorm';
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import type { EmojiDraftsRepository } from '@/models/_.js';
|
import type { EmojiRequestsRepository } from '@/models/_.js';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { EmojiDraftsEntityService } from '@/core/entities/EmojiDraftsEntityService.js';
|
import { EmojiRequestsEntityService } from '@/core/entities/EmojiRequestsEntityService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
|
@ -27,7 +26,7 @@ export const meta = {
|
||||||
items: {
|
items: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
ref: 'EmojiDraftSimple',
|
ref: 'EmojiRequestSimple',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -44,13 +43,13 @@ export const paramDef = {
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.emojiDraftsRepository)
|
@Inject(DI.emojiRequestsRepository)
|
||||||
private emojiDraftsRepository: EmojiDraftsRepository,
|
private emojiRequestsRepository: EmojiRequestsRepository,
|
||||||
|
|
||||||
private emojiDraftsEntityService: EmojiDraftsEntityService,
|
private emojiRequestsEntityService: EmojiRequestsEntityService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async () => {
|
super(meta, paramDef, async () => {
|
||||||
const emojis = await this.emojiDraftsRepository.find({
|
const emojis = await this.emojiRequestsRepository.find({
|
||||||
order: {
|
order: {
|
||||||
category: 'ASC',
|
category: 'ASC',
|
||||||
name: 'ASC',
|
name: 'ASC',
|
||||||
|
@ -58,7 +57,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
emojis: await this.emojiDraftsEntityService.packSimpleMany(emojis),
|
emojis: await this.emojiRequestsEntityService.packSimpleMany(emojis),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -20,10 +20,10 @@
|
||||||
<template #default="{items}">
|
<template #default="{items}">
|
||||||
<div class="ldhfsamy">
|
<div class="ldhfsamy">
|
||||||
<div v-for="emoji in items" :key="emoji.id">
|
<div v-for="emoji in items" :key="emoji.id">
|
||||||
<button v-if="emoji.draft" class="emoji _panel _button emoji-draft" :class="{ selected: selectedEmojis.includes(emoji.id) }" @click="selectMode ? toggleSelect(emoji) : edit(emoji)">
|
<button v-if="emoji.request" class="emoji _panel _button emoji-request" :class="{ selected: selectedEmojis.includes(emoji.id) }" @click="selectMode ? toggleSelect(emoji) : edit(emoji)">
|
||||||
<img :src="emoji.url" class="img" :alt="emoji.name"/>
|
<img :src="emoji.url" class="img" :alt="emoji.name"/>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="name _monospace">{{ emoji.name + ' (draft)' }}</div>
|
<div class="name _monospace">{{ emoji.name }}</div>
|
||||||
<div class="info">{{ emoji.category }}</div>
|
<div class="info">{{ emoji.category }}</div>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
@ -82,7 +82,7 @@ const toggleSelect = (emoji) => {
|
||||||
const edit = (emoji) => {
|
const edit = (emoji) => {
|
||||||
os.popup(defineAsyncComponent(() => import('@/components/MkEmojiEditDialog.vue')), {
|
os.popup(defineAsyncComponent(() => import('@/components/MkEmojiEditDialog.vue')), {
|
||||||
emoji: emoji,
|
emoji: emoji,
|
||||||
isRequest: false,
|
requestNow: false,
|
||||||
}, {
|
}, {
|
||||||
done: result => {
|
done: result => {
|
||||||
if (result.updated) {
|
if (result.updated) {
|
||||||
|
@ -217,7 +217,7 @@ const delBulk = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.emoji-draft {
|
.emoji-request {
|
||||||
--c: rgb(255 196 0 / 15%);;
|
--c: rgb(255 196 0 / 15%);;
|
||||||
background-image: linear-gradient(45deg,var(--c) 16.67%,transparent 16.67%,transparent 50%,var(--c) 50%,var(--c) 66.67%,transparent 66.67%,transparent 100%);
|
background-image: linear-gradient(45deg,var(--c) 16.67%,transparent 16.67%,transparent 50%,var(--c) 50%,var(--c) 66.67%,transparent 66.67%,transparent 100%);
|
||||||
background-size: 16px 16px;
|
background-size: 16px 16px;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<MkPagination ref="emojisDraftPaginationComponent" :pagination="paginationDraft">
|
<MkPagination ref="emojisRequestPaginationComponent" :pagination="paginationRequest">
|
||||||
<template #empty><span>{{ i18n.ts.noCustomEmojis }}</span></template>
|
<template #empty><span>{{ i18n.ts.noCustomEmojis }}</span></template>
|
||||||
<template #default="{items}">
|
<template #default="{items}">
|
||||||
<div class="ldhfsamy">
|
<div class="ldhfsamy">
|
||||||
|
@ -16,13 +16,13 @@
|
||||||
<div class="license">{{ i18n.ts.license }}:{{ emoji.license }}</div>
|
<div class="license">{{ i18n.ts.license }}:{{ emoji.license }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="edit-button">
|
<div class="edit-button">
|
||||||
<MkButton primary class="edit" @click="editDraft(emoji)">
|
<MkButton primary class="edit" @click="editRequest(emoji)">
|
||||||
{{ i18n.ts.edit }}
|
{{ i18n.ts.edit }}
|
||||||
</MkButton>
|
</MkButton>
|
||||||
<MkButton class="draft" @click="undrafted(emoji)">
|
<MkButton class="request" @click="unrequested(emoji)">
|
||||||
{{ i18n.ts.undrafted }}
|
{{ i18n.ts.requestApproval }}
|
||||||
</MkButton>
|
</MkButton>
|
||||||
<MkButton danger class="delete" @click="deleteDraft(emoji)">
|
<MkButton danger class="delete" @click="deleteRequest(emoji)">
|
||||||
{{ i18n.ts.delete }}
|
{{ i18n.ts.delete }}
|
||||||
</MkButton>
|
</MkButton>
|
||||||
</div>
|
</div>
|
||||||
|
@ -40,48 +40,48 @@ import * as os from '@/os';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
|
||||||
const emojisDraftPaginationComponent = shallowRef<InstanceType<typeof MkPagination>>();
|
const emojisRequestPaginationComponent = shallowRef<InstanceType<typeof MkPagination>>();
|
||||||
|
|
||||||
const query = ref(null);
|
const query = ref(null);
|
||||||
|
|
||||||
const paginationDraft = {
|
const paginationRequest = {
|
||||||
endpoint: 'admin/emoji/list-draft' as const,
|
endpoint: 'admin/emoji/list-request' as const,
|
||||||
limit: 30,
|
limit: 30,
|
||||||
params: computed(() => ({
|
params: computed(() => ({
|
||||||
query: (query.value && query.value !== '') ? query.value : null,
|
query: (query.value && query.value !== '') ? query.value : null,
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
|
|
||||||
const editDraft = (emoji) => {
|
const editRequest = (emoji) => {
|
||||||
emoji.isDraft = true;
|
emoji.requestNow = true;
|
||||||
os.popup(defineAsyncComponent(() => import('@/components/MkEmojiEditDialog.vue')), {
|
os.popup(defineAsyncComponent(() => import('@/components/MkEmojiEditDialog.vue')), {
|
||||||
emoji: emoji,
|
emoji: emoji,
|
||||||
isRequest: false,
|
requestNow: false,
|
||||||
isDraftEdit: true,
|
isRequestEdit: true,
|
||||||
}, {
|
}, {
|
||||||
done: result => {
|
done: result => {
|
||||||
if (result.updated) {
|
if (result.updated) {
|
||||||
emojisDraftPaginationComponent.value.updateItem(result.updated.id, (oldEmoji: any) => ({
|
emojisRequestPaginationComponent.value.updateItem(result.updated.id, (oldEmoji: any) => ({
|
||||||
...oldEmoji,
|
...oldEmoji,
|
||||||
...result.updated,
|
...result.updated,
|
||||||
}));
|
}));
|
||||||
emojisDraftPaginationComponent.value.reload();
|
emojisRequestPaginationComponent.value.reload();
|
||||||
} else if (result.deleted) {
|
} else if (result.deleted) {
|
||||||
emojisDraftPaginationComponent.value.removeItem((item) => item.id === emoji.id);
|
emojisRequestPaginationComponent.value.removeItem((item) => item.id === emoji.id);
|
||||||
emojisDraftPaginationComponent.value.reload();
|
emojisRequestPaginationComponent.value.reload();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}, 'closed');
|
}, 'closed');
|
||||||
};
|
};
|
||||||
|
|
||||||
async function undrafted(emoji) {
|
async function unrequested(emoji) {
|
||||||
const { canceled } = await os.confirm({
|
const { canceled } = await os.confirm({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
text: i18n.t('undraftAreYouSure', { x: emoji.name }),
|
text: i18n.t('requestApprovalAreYouSure', { x: emoji.name }),
|
||||||
});
|
});
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
|
|
||||||
await os.api('admin/emoji/update-draft', {
|
await os.api('admin/emoji/update-request', {
|
||||||
id: emoji.id,
|
id: emoji.id,
|
||||||
fileId: emoji.fileId,
|
fileId: emoji.fileId,
|
||||||
name: emoji.name,
|
name: emoji.name,
|
||||||
|
@ -90,14 +90,14 @@ async function undrafted(emoji) {
|
||||||
license: emoji.license,
|
license: emoji.license,
|
||||||
isSensitive: emoji.isSensitive,
|
isSensitive: emoji.isSensitive,
|
||||||
localOnly: emoji.localOnly,
|
localOnly: emoji.localOnly,
|
||||||
isDraft: false,
|
isRequest: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
emojisDraftPaginationComponent.value.removeItem((item) => item.id === emoji.id);
|
emojisRequestPaginationComponent.value.removeItem((item) => item.id === emoji.id);
|
||||||
emojisDraftPaginationComponent.value.reload();
|
emojisRequestPaginationComponent.value.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteDraft(emoji) {
|
async function deleteRequest(emoji) {
|
||||||
const { canceled } = await os.confirm({
|
const { canceled } = await os.confirm({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
text: i18n.t('removeAreYouSure', { x: emoji.name }),
|
text: i18n.t('removeAreYouSure', { x: emoji.name }),
|
||||||
|
@ -107,8 +107,8 @@ async function deleteDraft(emoji) {
|
||||||
os.api('admin/emoji/delete', {
|
os.api('admin/emoji/delete', {
|
||||||
id: emoji.id,
|
id: emoji.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
emojisDraftPaginationComponent.value.removeItem((item) => item.id === emoji.id);
|
emojisRequestPaginationComponent.value.removeItem((item) => item.id === emoji.id);
|
||||||
emojisDraftPaginationComponent.value.reload();
|
emojisRequestPaginationComponent.value.reload();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -198,7 +198,7 @@ async function deleteDraft(emoji) {
|
||||||
margin: 6px 0;
|
margin: 6px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
> .draft {
|
> .request {
|
||||||
grid-row: 2;
|
grid-row: 2;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 6px 0;
|
margin: 6px 0;
|
|
@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
@closed="$emit('closed')"
|
@closed="$emit('closed')"
|
||||||
>
|
>
|
||||||
<template v-if="emoji" #header>:{{ emoji.name }}:</template>
|
<template v-if="emoji" #header>:{{ emoji.name }}:</template>
|
||||||
<template v-else-if="isRequest" #header>{{ i18n.ts.requestCustomEmojis }}</template>
|
<template v-else-if="requestNow" #header>{{ i18n.ts.requestCustomEmojis }}</template>
|
||||||
<template v-else #header>New emoji</template>
|
<template v-else #header>New emoji</template>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@ -46,7 +46,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkInput v-model="license">
|
<MkInput v-model="license">
|
||||||
<template #label>{{ i18n.ts.license }}</template>
|
<template #label>{{ i18n.ts.license }}</template>
|
||||||
</MkInput>
|
</MkInput>
|
||||||
<MkFolder v-if="!isRequest && !isDraftEdit">
|
<MkFolder v-if="!requestNow && !isRequestEdit">
|
||||||
<template #label>{{ i18n.ts.rolesThatCanBeUsedThisEmojiAsReaction }}</template>
|
<template #label>{{ i18n.ts.rolesThatCanBeUsedThisEmojiAsReaction }}</template>
|
||||||
<template #suffix>{{ rolesThatCanBeUsedThisEmojiAsReaction.length === 0 ? i18n.ts.all : rolesThatCanBeUsedThisEmojiAsReaction.length }}</template>
|
<template #suffix>{{ rolesThatCanBeUsedThisEmojiAsReaction.length === 0 ? i18n.ts.all : rolesThatCanBeUsedThisEmojiAsReaction.length }}</template>
|
||||||
|
|
||||||
|
@ -65,14 +65,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</MkFolder>
|
</MkFolder>
|
||||||
<MkSwitch v-model="isSensitive">isSensitive</MkSwitch>
|
<MkSwitch v-model="isSensitive">isSensitive</MkSwitch>
|
||||||
<MkSwitch v-model="localOnly">{{ i18n.ts.localOnly }}</MkSwitch>
|
<MkSwitch v-model="localOnly">{{ i18n.ts.localOnly }}</MkSwitch>
|
||||||
<MkSwitch v-if="!isRequest" v-model="isDraft" :disabled="isRequest">
|
<MkSwitch v-if="!requestNow" v-model="isRequest" :disabled="requestNow">
|
||||||
{{ i18n.ts.draft }}
|
{{ i18n.ts.requestPending }}
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
</div>
|
</div>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
<div :class="$style.footer">
|
<div :class="$style.footer">
|
||||||
<div :class="$style.footerButtons">
|
<div :class="$style.footerButtons">
|
||||||
<MkButton v-if="!isRequest" danger rounded style="margin: 0 auto;" @click="del()"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
<MkButton v-if="!requestNow" danger rounded style="margin: 0 auto;" @click="del()"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
||||||
<MkButton v-if="validation" primary rounded style="margin: 0 auto;" @click="done"><i class="ti ti-check"></i> {{ props.emoji ? i18n.ts.update : i18n.ts.create }}</MkButton>
|
<MkButton v-if="validation" primary rounded style="margin: 0 auto;" @click="done"><i class="ti ti-check"></i> {{ props.emoji ? i18n.ts.update : i18n.ts.create }}</MkButton>
|
||||||
<MkButton v-else rounded style="margin: 0 auto;"><i class="ti ti-check"></i> {{ props.emoji ? i18n.ts.update : i18n.ts.create }}</MkButton>
|
<MkButton v-else rounded style="margin: 0 auto;"><i class="ti ti-check"></i> {{ props.emoji ? i18n.ts.update : i18n.ts.create }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
|
@ -99,8 +99,8 @@ import MkRolePreview from '@/components/MkRolePreview.vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
emoji?: any,
|
emoji?: any,
|
||||||
isRequest: boolean,
|
requestNow: boolean,
|
||||||
isDraftEdit?: boolean,
|
isRequestEdit?: boolean,
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
let dialog = $ref(null);
|
let dialog = $ref(null);
|
||||||
|
@ -114,14 +114,14 @@ let roleIdsThatCanBeUsedThisEmojiAsReaction = $ref((props.emoji && props.emoji.r
|
||||||
let rolesThatCanBeUsedThisEmojiAsReaction = $ref([]);
|
let rolesThatCanBeUsedThisEmojiAsReaction = $ref([]);
|
||||||
let file = $ref<Misskey.entities.DriveFile>();
|
let file = $ref<Misskey.entities.DriveFile>();
|
||||||
let chooseFile: DriveFile|null = $ref(null);
|
let chooseFile: DriveFile|null = $ref(null);
|
||||||
let isRequest = $ref(props.isRequest);
|
let requestNow = $ref(props.requestNow);
|
||||||
let isDraftEdit = $ref(props.isDraftEdit ?? false);
|
let isRequestEdit = $ref(props.isRequestEdit ?? false);
|
||||||
let isDraft = $ref(!!(isDraftEdit || props.isRequest));
|
let isRequest = $ref(!!(isRequestEdit || props.requestNow));
|
||||||
watch($$(roleIdsThatCanBeUsedThisEmojiAsReaction), async () => {
|
watch($$(roleIdsThatCanBeUsedThisEmojiAsReaction), async () => {
|
||||||
rolesThatCanBeUsedThisEmojiAsReaction = (await Promise.all(roleIdsThatCanBeUsedThisEmojiAsReaction.map((id) => os.api('admin/roles/show', { roleId: id }).catch(() => null)))).filter(x => x != null);
|
rolesThatCanBeUsedThisEmojiAsReaction = (await Promise.all(roleIdsThatCanBeUsedThisEmojiAsReaction.map((id) => os.api('admin/roles/show', { roleId: id }).catch(() => null)))).filter(x => x != null);
|
||||||
}, { immediate: true });
|
}, { immediate: true });
|
||||||
|
|
||||||
const imgUrl = computed(() => file ? file.url : props.emoji && !isDraftEdit ? `/emoji/${props.emoji.name}.webp` : props.emoji && props.emoji.url ? props.emoji.url : null);
|
const imgUrl = computed(() => file ? file.url : props.emoji && !isRequestEdit ? `/emoji/${props.emoji.name}.webp` : props.emoji && props.emoji.url ? props.emoji.url : null);
|
||||||
const validation = computed(() => {
|
const validation = computed(() => {
|
||||||
return name.match(/^[a-zA-Z0-9_]+$/) && imgUrl.value != null;
|
return name.match(/^[a-zA-Z0-9_]+$/) && imgUrl.value != null;
|
||||||
});
|
});
|
||||||
|
@ -159,7 +159,7 @@ async function done() {
|
||||||
category: category === '' ? null : category,
|
category: category === '' ? null : category,
|
||||||
aliases: aliases.replace(' ', ' ').split(' ').filter(x => x !== ''),
|
aliases: aliases.replace(' ', ' ').split(' ').filter(x => x !== ''),
|
||||||
license: license === '' ? null : license,
|
license: license === '' ? null : license,
|
||||||
draft: isDraft,
|
Request: isRequest,
|
||||||
isSensitive,
|
isSensitive,
|
||||||
localOnly,
|
localOnly,
|
||||||
roleIdsThatCanBeUsedThisEmojiAsReaction: rolesThatCanBeUsedThisEmojiAsReaction.map(x => x.id),
|
roleIdsThatCanBeUsedThisEmojiAsReaction: rolesThatCanBeUsedThisEmojiAsReaction.map(x => x.id),
|
||||||
|
@ -170,8 +170,8 @@ async function done() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.emoji) {
|
if (props.emoji) {
|
||||||
if (isDraftEdit) {
|
if (isRequestEdit) {
|
||||||
await os.apiWithDialog('admin/emoji/update-draft', {
|
await os.apiWithDialog('admin/emoji/update-request', {
|
||||||
id: props.emoji.id,
|
id: props.emoji.id,
|
||||||
...params,
|
...params,
|
||||||
});
|
});
|
||||||
|
@ -192,7 +192,7 @@ async function done() {
|
||||||
dialog.close();
|
dialog.close();
|
||||||
} else {
|
} else {
|
||||||
const created = isRequest
|
const created = isRequest
|
||||||
? await os.apiWithDialog('admin/emoji/add-draft', params)
|
? await os.apiWithDialog('admin/emoji/add-request', params)
|
||||||
: await os.apiWithDialog('admin/emoji/add', params);
|
: await os.apiWithDialog('admin/emoji/add', params);
|
||||||
|
|
||||||
emit('done', {
|
emit('done', {
|
||||||
|
|
|
@ -76,7 +76,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
v-for="category in customEmojiCategories"
|
v-for="category in customEmojiCategories"
|
||||||
:key="`custom:${category}`"
|
:key="`custom:${category}`"
|
||||||
:initialShown="false"
|
:initialShown="false"
|
||||||
:emojis="computed(() => customEmojis.filter(emoji => !emoji.draft).filter(e => category === null ? (e.category === 'null' || !e.category) : e.category === category).filter(filterAvailable).map(e => `:${e.name}:`))"
|
:emojis="computed(() => customEmojis.filter(e => category === null ? (e.category === 'null' || !e.category) : e.category === category).filter(filterAvailable).map(e => `:${e.name}:`))"
|
||||||
@chosen="chosen"
|
@chosen="chosen"
|
||||||
>
|
>
|
||||||
{{ category || i18n.ts.other }}
|
{{ category || i18n.ts.other }}
|
||||||
|
|
|
@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkFoldableSection v-if="searchEmojis">
|
<MkFoldableSection v-if="searchEmojis">
|
||||||
<template #header>{{ i18n.ts.searchResult }}</template>
|
<template #header>{{ i18n.ts.searchResult }}</template>
|
||||||
<div :class="$style.emojis">
|
<div :class="$style.emojis">
|
||||||
<XEmoji v-for="emoji in searchEmojis" :key="emoji.name" :emoji="emoji" :draft="emoji.draft"/>
|
<XEmoji v-for="emoji in searchEmojis" :key="emoji.name" :emoji="emoji" :request="emoji.request"/>
|
||||||
</div>
|
</div>
|
||||||
</MkFoldableSection>
|
</MkFoldableSection>
|
||||||
|
|
||||||
|
@ -36,9 +36,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
</MkFoldableSection>
|
</MkFoldableSection>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
<MkSpacer v-if="tab === 'draft'" :contentMax="1000" :marginMin="20">
|
<MkSpacer v-if="tab === 'request'" :contentMax="1000" :marginMin="20">
|
||||||
<div :class="$style.emojis">
|
<div :class="$style.emojis">
|
||||||
<XEmoji v-for="emoji in draftEmojis.emojis" :key="emoji.name" :emoji="emoji" :draft="true"/>
|
<XEmoji v-for="emoji in requestEmojis.emojis" :key="emoji.name" :emoji="emoji" :request="true"/>
|
||||||
</div>
|
</div>
|
||||||
</MkSpacer>
|
</MkSpacer>
|
||||||
</MkStickyContainer>
|
</MkStickyContainer>
|
||||||
|
@ -64,7 +64,7 @@ const headerTabs = $computed(() => [{
|
||||||
key: 'emojis',
|
key: 'emojis',
|
||||||
title: i18n.ts.list,
|
title: i18n.ts.list,
|
||||||
}, {
|
}, {
|
||||||
key: 'draft',
|
key: 'request',
|
||||||
title: i18n.ts.requestEmojis,
|
title: i18n.ts.requestEmojis,
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ definePageMetadata(ref({}));
|
||||||
let q = $ref('');
|
let q = $ref('');
|
||||||
let searchEmojis = $ref<Misskey.entities.CustomEmoji[]>(null);
|
let searchEmojis = $ref<Misskey.entities.CustomEmoji[]>(null);
|
||||||
let selectedTags = $ref(new Set());
|
let selectedTags = $ref(new Set());
|
||||||
const draftEmojis = await os.apiGet('emoji-drafts');
|
const requestEmojis = await os.apiGet('emoji-requests');
|
||||||
function search() {
|
function search() {
|
||||||
if ((q === '' || q == null) && selectedTags.size === 0) {
|
if ((q === '' || q == null) && selectedTags.size === 0) {
|
||||||
searchEmojis = null;
|
searchEmojis = null;
|
||||||
|
@ -97,7 +97,7 @@ function search() {
|
||||||
|
|
||||||
const edit = () => {
|
const edit = () => {
|
||||||
os.popup(defineAsyncComponent(() => import('@/components/MkEmojiEditDialog.vue')), {
|
os.popup(defineAsyncComponent(() => import('@/components/MkEmojiEditDialog.vue')), {
|
||||||
isRequest: true,
|
requestNow: true,
|
||||||
}, {
|
}, {
|
||||||
done: result => {
|
done: result => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
|
|
@ -12,8 +12,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div v-if="tab === 'local'" class="local">
|
<div v-if="tab === 'local'" class="local">
|
||||||
<MkCustomEmojiEditLocal/>
|
<MkCustomEmojiEditLocal/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="tab === 'draft'" class="draft">
|
<div v-if="tab === 'request'" class="request">
|
||||||
<MkCustomEmojiEditDraft/>
|
<MkCustomEmojiEditRequest/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="tab === 'remote'" class="remote">
|
<div v-else-if="tab === 'remote'" class="remote">
|
||||||
<MkCustomEmojiEditRemote/>
|
<MkCustomEmojiEditRemote/>
|
||||||
|
@ -26,7 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, defineAsyncComponent, ref } from 'vue';
|
import { computed, defineAsyncComponent, ref } from 'vue';
|
||||||
import MkCustomEmojiEditDraft from '@/components/MkCustomEmojiEditDraft.vue';
|
import MkCustomEmojiEditRequest from '@/components/MkCustomEmojiEditRequest.vue';
|
||||||
import MkCustomEmojiEditLocal from '@/components/MkCustomEmojiEditLocal.vue';
|
import MkCustomEmojiEditLocal from '@/components/MkCustomEmojiEditLocal.vue';
|
||||||
import MkCustomEmojiEditRemote from '@/components/MkCustomEmojiEditRemote.vue';
|
import MkCustomEmojiEditRemote from '@/components/MkCustomEmojiEditRemote.vue';
|
||||||
import { selectFile } from '@/scripts/select-file';
|
import { selectFile } from '@/scripts/select-file';
|
||||||
|
@ -34,7 +34,7 @@ import * as os from '@/os';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
|
|
||||||
const tab = ref('draft');
|
const tab = ref('request');
|
||||||
|
|
||||||
const add = async (ev: MouseEvent) => {
|
const add = async (ev: MouseEvent) => {
|
||||||
os.popup(defineAsyncComponent(() => import('@/components/MkEmojiEditDialog.vue')), {
|
os.popup(defineAsyncComponent(() => import('@/components/MkEmojiEditDialog.vue')), {
|
||||||
|
@ -102,7 +102,7 @@ const headerActions = $computed(() => [{
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
const headerTabs = $computed(() => [{
|
const headerTabs = $computed(() => [{
|
||||||
key: 'draft',
|
key: 'request',
|
||||||
title: i18n.ts.requestEmojis,
|
title: i18n.ts.requestEmojis,
|
||||||
}, {
|
}, {
|
||||||
key: 'local',
|
key: 'local',
|
||||||
|
|
|
@ -4,10 +4,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<button v-if="draft" class="_button emoji-draft" :class="$style.root" @click="menu">
|
<button v-if="request" class="_button emoji-request" :class="$style.root" @click="menu">
|
||||||
<img :src="emoji.url" :class="$style.img" loading="lazy"/>
|
<img :src="emoji.url" :class="$style.img" loading="lazy"/>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="name _monospace">{{ emoji.name + ' (draft)' }}</div>
|
<div class="name _monospace">{{ emoji.name + ' (request)' }}</div>
|
||||||
<div class="info">{{ emoji.aliases.join(' ') }}</div>
|
<div class="info">{{ emoji.aliases.join(' ') }}</div>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
@ -32,7 +32,7 @@ const props = defineProps<{
|
||||||
category: string;
|
category: string;
|
||||||
url: string;
|
url: string;
|
||||||
};
|
};
|
||||||
draft?: boolean;
|
request?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
function menu(ev) {
|
function menu(ev) {
|
||||||
|
@ -50,7 +50,7 @@ function menu(ev) {
|
||||||
text: i18n.ts.info,
|
text: i18n.ts.info,
|
||||||
icon: 'ti ti-info-circle',
|
icon: 'ti ti-info-circle',
|
||||||
action: () => {
|
action: () => {
|
||||||
os.apiGet('emoji-drafts', { name: props.emoji.name }).then(res => {
|
os.apiGet('emoji-requests', { name: props.emoji.name }).then(res => {
|
||||||
os.alert({
|
os.alert({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
text: `License: ${res.license}`,
|
text: `License: ${res.license}`,
|
||||||
|
@ -99,7 +99,7 @@ function menu(ev) {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.emoji-draft {
|
.emoji-request {
|
||||||
--c: rgb(255 196 0 / 15%);;
|
--c: rgb(255 196 0 / 15%);;
|
||||||
background-image: linear-gradient(45deg,var(--c) 16.67%,transparent 16.67%,transparent 50%,var(--c) 50%,var(--c) 66.67%,transparent 66.67%,transparent 100%);
|
background-image: linear-gradient(45deg,var(--c) 16.67%,transparent 16.67%,transparent 50%,var(--c) 50%,var(--c) 66.67%,transparent 66.67%,transparent 100%);
|
||||||
background-size: 16px 16px;
|
background-size: 16px 16px;
|
||||||
|
|
|
@ -284,7 +284,7 @@ type CustomEmoji = {
|
||||||
url: string;
|
url: string;
|
||||||
category: string;
|
category: string;
|
||||||
aliases: string[];
|
aliases: string[];
|
||||||
draft: boolean;
|
Request: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
|
|
|
@ -319,7 +319,7 @@ export type CustomEmoji = {
|
||||||
url: string;
|
url: string;
|
||||||
category: string;
|
category: string;
|
||||||
aliases: string[];
|
aliases: string[];
|
||||||
draft: boolean;
|
Request: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type LiteInstanceMetadata = {
|
export type LiteInstanceMetadata = {
|
||||||
|
|
Loading…
Reference in New Issue