fix(wip): update custom emojis event

This commit is contained in:
Nya Candy 2024-07-30 23:44:02 +08:00 committed by fly_mc
parent 41be76fc53
commit 21e1598584
2 changed files with 6 additions and 4 deletions

View file

@ -121,8 +121,8 @@ export interface NoteEventTypes {
cw: string | null;
text: string;
updatedAt: string;
tags: string[];
emojis: string[];
tags?: string[];
emojis?: Record<string, string>;
};
reacted: {
reaction: string;

View file

@ -31,6 +31,7 @@ import { RemoteUserResolveService } from '@/core/RemoteUserResolveService.js';
import { extractHashtags } from "@/misc/extract-hashtags.js";
import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js";
import { UtilityService } from "@/core/UtilityService.js";
import { CustomEmojiService } from "@/core/CustomEmojiService.js";
type Option = Pick<MiNote, 'text' | 'cw' | 'updatedAt'> & {
apHashtags?: string[] | null;
@ -52,6 +53,7 @@ export class NoteUpdateService {
@Inject(DI.instancesRepository)
private instancesRepository: InstancesRepository,
private customEmojiService: CustomEmojiService,
private userEntityService: UserEntityService,
private noteEntityService: NoteEntityService,
private globalEventService: GlobalEventService,
@ -128,8 +130,8 @@ export class NoteUpdateService {
cw: ps.cw,
text: ps.text ?? '', // prevent null
updatedAt: ps.updatedAt.toISOString(),
tags,
emojis,
tags: tags.length > 0 ? tags : undefined,
emojis: note.userHost != null ? await this.customEmojiService.populateEmojis(emojis, note.userHost) : undefined,
});
if (this.userEntityService.isLocalUser(user) && !note.localOnly) {