From 17951950970cd73dd5781f533965cb87a28b5e92 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Fri, 22 Sep 2023 22:54:35 +0200 Subject: [PATCH] fix: update? what update --- packages/backend/src/core/NoteEditService.ts | 6 ++++-- packages/backend/src/models/_.ts | 2 +- packages/backend/src/server/api/endpoints/notes/edit.ts | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/core/NoteEditService.ts b/packages/backend/src/core/NoteEditService.ts index c8cf69f93..35ff02f78 100644 --- a/packages/backend/src/core/NoteEditService.ts +++ b/packages/backend/src/core/NoteEditService.ts @@ -216,7 +216,7 @@ export class NoteEditService implements OnApplicationShutdown { throw new Error('fail'); }; - let oldnote = await this.notesRepository.findOneBy({ + const oldnote = await this.notesRepository.findOneBy({ id: editid, }); @@ -711,10 +711,12 @@ export class NoteEditService implements OnApplicationShutdown { @bindThis private async renderNoteOrRenoteActivity(data: Option, note: MiNote) { if (data.localOnly) return null; + const user = await this.usersRepository.findOneBy({ id: note.userId }); + if (user == null) throw new Error('user not found'); const content = data.renote && data.text == null && data.poll == null && (data.files == null || data.files.length === 0) ? this.apRendererService.renderAnnounce(data.renote.uri ? data.renote.uri : `${this.config.url}/notes/${data.renote.id}`, note) - : this.apRendererService.renderCreate(await this.apRendererService.renderNote(note, false), note); + : this.apRendererService.renderUpdate(await this.apRendererService.renderNote(note, false), user); return this.apRendererService.addContext(content); } diff --git a/packages/backend/src/models/_.ts b/packages/backend/src/models/_.ts index e6eafa418..ca047569c 100644 --- a/packages/backend/src/models/_.ts +++ b/packages/backend/src/models/_.ts @@ -205,4 +205,4 @@ export type RoleAssignmentsRepository = Repository; export type FlashsRepository = Repository; export type FlashLikesRepository = Repository; export type UserMemoRepository = Repository; -export type NoteEditRepository = Repository; \ No newline at end of file +export type NoteEditRepository = Repository; diff --git a/packages/backend/src/server/api/endpoints/notes/edit.ts b/packages/backend/src/server/api/endpoints/notes/edit.ts index 0d621c40b..07f04bba5 100644 --- a/packages/backend/src/server/api/endpoints/notes/edit.ts +++ b/packages/backend/src/server/api/endpoints/notes/edit.ts @@ -354,4 +354,4 @@ export default class extends Endpoint { // eslint- }; }); } -} \ No newline at end of file +}