diff options
| author | dakkar <dakkar@thenautilus.net> | 2025-02-20 10:20:49 +0000 |
|---|---|---|
| committer | dakkar <dakkar@thenautilus.net> | 2025-02-20 10:20:49 +0000 |
| commit | 534c35cca2b2492dea05b7c7b23802af5435291a (patch) | |
| tree | d3dec52a465dc2797919e03a7d2d049960a1c86e /packages/backend/src/core/NoteEditService.ts | |
| parent | merge: Add separate redis for rate limit (!908) (diff) | |
| parent | add `admin/cw-user` to new endpoints list (diff) | |
| download | sharkey-534c35cca2b2492dea05b7c7b23802af5435291a.tar.gz sharkey-534c35cca2b2492dea05b7c7b23802af5435291a.tar.bz2 sharkey-534c35cca2b2492dea05b7c7b23802af5435291a.zip | |
merge: Add "force content warning" setting for user moderation (resolves #905) (!876)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/876
Closes #905
Approved-by: dakkar <dakkar@thenautilus.net>
Approved-by: Marie <github@yuugi.dev>
Diffstat (limited to 'packages/backend/src/core/NoteEditService.ts')
| -rw-r--r-- | packages/backend/src/core/NoteEditService.ts | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/packages/backend/src/core/NoteEditService.ts b/packages/backend/src/core/NoteEditService.ts index 453ad5d9d0..24a99156d2 100644 --- a/packages/backend/src/core/NoteEditService.ts +++ b/packages/backend/src/core/NoteEditService.ts @@ -224,7 +224,7 @@ export class NoteEditService implements OnApplicationShutdown { } @bindThis - public async edit(user: { + public async edit(user: MiUser & { id: MiUser['id']; username: MiUser['username']; host: MiUser['host']; @@ -309,7 +309,7 @@ export class NoteEditService implements OnApplicationShutdown { if (this.isRenote(data)) { if (data.renote.id === oldnote.id) { - throw new Error("A note can't renote itself"); + throw new Error('A note can\'t renote itself'); } switch (data.renote.visibility) { @@ -584,7 +584,7 @@ export class NoteEditService implements OnApplicationShutdown { } @bindThis - private async postNoteEdited(note: MiNote, oldNote: MiNote, user: { + private async postNoteEdited(note: MiNote, oldNote: MiNote, user: MiUser & { id: MiUser['id']; username: MiUser['username']; host: MiUser['host']; @@ -703,7 +703,7 @@ export class NoteEditService implements OnApplicationShutdown { //#region AP deliver if (!data.localOnly && this.userEntityService.isLocalUser(user)) { (async () => { - const noteActivity = await this.renderNoteOrRenoteActivity(data, note); + const noteActivity = await this.renderNoteOrRenoteActivity(data, note, user); const dm = this.apDeliverManagerService.createDeliverManager(user, noteActivity); // メンションされたリモートユーザーに配送 @@ -834,14 +834,12 @@ export class NoteEditService implements OnApplicationShutdown { } @bindThis - private async renderNoteOrRenoteActivity(data: Option, note: MiNote) { + private async renderNoteOrRenoteActivity(data: Option, note: MiNote, user: MiUser) { 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 = this.isRenote(data) && !this.isQuote(data) ? this.apRendererService.renderAnnounce(data.renote.uri ? data.renote.uri : `${this.config.url}/notes/${data.renote.id}`, note) - : this.apRendererService.renderUpdate(await this.apRendererService.renderUpNote(note, false), user); + : this.apRendererService.renderUpdate(await this.apRendererService.renderUpNote(note, user, false), user); return this.apRendererService.addContext(content); } |