diff options
| author | dakkar <dakkar@thenautilus.net> | 2024-04-25 11:31:35 +0100 |
|---|---|---|
| committer | dakkar <dakkar@thenautilus.net> | 2024-04-25 11:44:24 +0100 |
| commit | 4fe8a260817d30385cddecad91a4e84c15889666 (patch) | |
| tree | 70ef7d0215767befa923b41b53cff67a5130eda2 /packages/backend/src/core/NoteCreateService.ts | |
| parent | Merge branch 'develop' into future-2024-04-10-post (diff) | |
| parent | feat: improve emoji endpoint (#13742) (diff) | |
| download | sharkey-4fe8a260817d30385cddecad91a4e84c15889666.tar.gz sharkey-4fe8a260817d30385cddecad91a4e84c15889666.tar.bz2 sharkey-4fe8a260817d30385cddecad91a4e84c15889666.zip | |
Merge remote-tracking branch 'misskey/develop' into future-2024-04-25
Diffstat (limited to 'packages/backend/src/core/NoteCreateService.ts')
| -rw-r--r-- | packages/backend/src/core/NoteCreateService.ts | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 631d7074bd..9b6d4d2901 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -495,7 +495,7 @@ export class NoteCreateService implements OnApplicationShutdown { } // Check blocking - if (data.renote && !this.isQuote(data)) { + if (this.isRenote(data) && !this.isQuote(data)) { if (data.renote.userHost === null) { if (data.renote.userId !== user.id) { const blocked = await this.userBlockingService.checkBlocked(data.renote.userId, user.id); @@ -855,7 +855,7 @@ export class NoteCreateService implements OnApplicationShutdown { } // If it is renote - if (data.renote) { + if (this.isRenote(data)) { const type = this.isQuote(data) ? 'quote' : 'renote'; // Notify @@ -1055,9 +1055,20 @@ export class NoteCreateService implements OnApplicationShutdown { } @bindThis - private isQuote(note: Option): note is Option & { renote: MiNote } { - // sync with misc/is-quote.ts - return !!note.renote && (!!note.text || !!note.cw || (!!note.files && !!note.files.length) || !!note.poll); + private isRenote(note: Option): note is Option & { renote: MiNote } { + return note.renote != null; + } + + @bindThis + private isQuote(note: Option & { renote: MiNote }): note is Option & { renote: MiNote } & ( + { text: string } | { cw: string } | { reply: MiNote } | { poll: IPoll } | { files: MiDriveFile[] } + ) { + // NOTE: SYNC WITH misc/is-quote.ts + return note.text != null || + note.reply != null || + note.cw != null || + note.poll != null || + (note.files != null && note.files.length > 0); } @bindThis @@ -1133,7 +1144,7 @@ export class NoteCreateService implements OnApplicationShutdown { private async renderNoteOrRenoteActivity(data: Option, note: MiNote) { if (data.localOnly) return null; - const content = data.renote && !this.isQuote(data) + 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.renderCreate(await this.apRendererService.renderNote(note, false), note); |