diff --git a/packages/backend/src/core/NoteUpdateService.ts b/packages/backend/src/core/NoteUpdateService.ts index d52c744b25..db80036526 100644 --- a/packages/backend/src/core/NoteUpdateService.ts +++ b/packages/backend/src/core/NoteUpdateService.ts @@ -4,8 +4,10 @@ */ import { setImmediate } from 'node:timers/promises'; +import util from 'util'; import { In, DataSource } from 'typeorm'; import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; +import * as mfm from 'mfm-js'; import type { IMentionedRemoteUsers } from '@/models/Note.js'; import { MiNote } from '@/models/Note.js'; import type { NotesRepository, UsersRepository } from '@/models/_.js'; @@ -20,14 +22,12 @@ import { ApDeliverManagerService } from '@/core/activitypub/ApDeliverManagerServ import { bindThis } from '@/decorators.js'; import { DB_MAX_NOTE_TEXT_LENGTH } from '@/const.js'; import { SearchService } from '@/core/SearchService.js'; -import { normalizeForSearch } from "@/misc/normalize-for-search.js"; +import { normalizeForSearch } from '@/misc/normalize-for-search.js'; import { MiDriveFile } from '@/models/_.js'; import { MiPoll, IPoll } from '@/models/Poll.js'; -import * as mfm from "cherrypick-mfm-js"; -import { concat } from "@/misc/prelude/array.js"; -import { extractHashtags } from "@/misc/extract-hashtags.js"; -import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js"; -import util from 'util'; +import { concat } from '@/misc/prelude/array.js'; +import { extractHashtags } from '@/misc/extract-hashtags.js'; +import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js'; type MinimumUser = { id: MiUser['id']; @@ -187,10 +187,10 @@ export class NoteUpdateService implements OnApplicationShutdown { } else if (note.hasPoll && !values.hasPoll) { // Start transaction await this.db.transaction(async transactionalEntityManager => { - await transactionalEntityManager.update(MiNote, {id: note.id}, values); + await transactionalEntityManager.update(MiNote, { id: note.id }, values); if (!values.hasPoll) { - await transactionalEntityManager.delete(MiPoll, {noteId: note.id}); + await transactionalEntityManager.delete(MiPoll, { noteId: note.id }); } }); } else { diff --git a/packages/backend/src/core/activitypub/models/ApNoteService.ts b/packages/backend/src/core/activitypub/models/ApNoteService.ts index 9ada6129aa..dd695527c4 100644 --- a/packages/backend/src/core/activitypub/models/ApNoteService.ts +++ b/packages/backend/src/core/activitypub/models/ApNoteService.ts @@ -24,12 +24,11 @@ import { StatusError } from '@/misc/status-error.js'; import { UtilityService } from '@/core/UtilityService.js'; import { bindThis } from '@/decorators.js'; import { checkHttps } from '@/misc/check-https.js'; -import type { IObject, IPost } from '../type.js'; +import { NoteUpdateService } from '@/core/NoteUpdateService.js'; import { getApId, getApType, getOneApHrefNullable, getOneApId, isEmoji, validPost } from '../type.js'; import { ApLoggerService } from '../ApLoggerService.js'; import { ApMfmService } from '../ApMfmService.js'; import { ApDbResolverService } from '../ApDbResolverService.js'; -import type { Resolver } from '../ApResolverService.js'; import { ApResolverService } from '../ApResolverService.js'; import { ApAudienceService } from '../ApAudienceService.js'; import { ApPersonService } from './ApPersonService.js'; @@ -37,7 +36,8 @@ import { extractApHashtags } from './tag.js'; import { ApMentionService } from './ApMentionService.js'; import { ApQuestionService } from './ApQuestionService.js'; import { ApImageService } from './ApImageService.js'; -import { NoteUpdateService } from '@/core/NoteUpdateService.js'; +import type { Resolver } from '../ApResolverService.js'; +import type { IObject, IPost } from '../type.js'; @Injectable() export class ApNoteService { @@ -53,9 +53,6 @@ export class ApNoteService { @Inject(DI.emojisRepository) private emojisRepository: EmojisRepository, - @Inject(DI.messagingMessagesRepository) - private messagingMessagesRepository: MessagingMessagesRepository, - @Inject(DI.notesRepository) private notesRepository: NotesRepository, @@ -348,7 +345,7 @@ export class ApNoteService { } const b_note = await this.notesRepository.findOneBy({ - uri: entryUri + uri: entryUri, }).then(x => { if (x == null) throw new Error('note not found'); return x; diff --git a/packages/backend/src/server/api/endpoints/notes/update.ts b/packages/backend/src/server/api/endpoints/notes/update.ts index 14553fbee7..e05a70c0e3 100644 --- a/packages/backend/src/server/api/endpoints/notes/update.ts +++ b/packages/backend/src/server/api/endpoints/notes/update.ts @@ -13,7 +13,6 @@ import { DI } from '@/di-symbols.js'; import { GetterService } from '@/server/api/GetterService.js'; import { MAX_NOTE_TEXT_LENGTH } from '@/const.js'; import { ApiError } from '../../error.js'; -import type { DriveFilesRepository, MiDriveFile } from "@/models/_.js"; export const meta = { tags: ['notes'], @@ -116,9 +115,6 @@ export default class extends Endpoint { // eslint- @Inject(DI.driveFilesRepository) private driveFilesRepository: DriveFilesRepository, - @Inject(DI.driveFilesRepository) - private driveFilesRepository: DriveFilesRepository, - private getterService: GetterService, private noteEntityService: NoteEntityService, private noteUpdateService: NoteUpdateService, @@ -133,7 +129,6 @@ export default class extends Endpoint { // eslint- throw new ApiError(meta.errors.noSuchNote); } - let files: MiDriveFile[] = []; const fileIds = ps.fileIds ?? ps.mediaIds ?? null; if (fileIds != null) {