From 7fd8ef344b33b0a157bc197cbd64069695806936 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:43:44 +0900 Subject: [PATCH] refactor --- .../backend/src/core/entities/NoteEntityService.ts | 12 +----------- packages/backend/src/misc/is-renote.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index e530772dd9..c24c80a5b5 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -16,23 +16,13 @@ import { bindThis } from '@/decorators.js'; import { DebounceLoader } from '@/misc/loader.js'; import { IdService } from '@/core/IdService.js'; import { ReactionsBufferingService } from '@/core/ReactionsBufferingService.js'; +import { isPureRenote } from '@/misc/is-renote.js'; import type { OnModuleInit } from '@nestjs/common'; import type { CustomEmojiService } from '../CustomEmojiService.js'; import type { ReactionService } from '../ReactionService.js'; import type { UserEntityService } from './UserEntityService.js'; import type { DriveFileEntityService } from './DriveFileEntityService.js'; -function isPureRenote(note: MiNote): note is MiNote & { renoteId: MiNote['id']; renote: MiNote } { - return ( - note.renote != null && - note.reply == null && - note.text == null && - note.cw == null && - (note.fileIds == null || note.fileIds.length === 0) && - !note.hasPoll - ); -} - function getAppearNoteIds(notes: MiNote[]): Set { const appearNoteIds = new Set(); for (const note of notes) { diff --git a/packages/backend/src/misc/is-renote.ts b/packages/backend/src/misc/is-renote.ts index 48f821806c..245057c64e 100644 --- a/packages/backend/src/misc/is-renote.ts +++ b/packages/backend/src/misc/is-renote.ts @@ -36,6 +36,17 @@ export function isQuote(note: Renote): note is Quote { note.fileIds.length > 0; } +export function isPureRenote(note: MiNote): note is MiNote & { renoteId: MiNote['id']; renote: MiNote } { + return ( + note.renote != null && + note.reply == null && + note.text == null && + note.cw == null && + (note.fileIds == null || note.fileIds.length === 0) && + !note.hasPoll + ); +} + type PackedRenote = Packed<'Note'> & { renoteId: NonNullable['renoteId']>