mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -07:00
[mastodon-client] Recurse one last time for reblogged quotes in NoteConverter.encode
This commit is contained in:
parent
b48594ef68
commit
32d471803c
1 changed files with 3 additions and 3 deletions
|
@ -23,7 +23,7 @@ import { NoteHelpers } from "@/server/api/mastodon/helpers/note.js";
|
||||||
import isQuote from "@/misc/is-quote.js";
|
import isQuote from "@/misc/is-quote.js";
|
||||||
|
|
||||||
export class NoteConverter {
|
export class NoteConverter {
|
||||||
public static async encode(note: Note, ctx: MastoContext, recurse: boolean = true): Promise<MastodonEntity.Status> {
|
public static async encode(note: Note, ctx: MastoContext, recurseCounter: number = 2): Promise<MastodonEntity.Status> {
|
||||||
const user = ctx.user as ILocalUser | null;
|
const user = ctx.user as ILocalUser | null;
|
||||||
const noteUser = note.user ?? UserHelpers.getUserCached(note.userId, ctx);
|
const noteUser = note.user ?? UserHelpers.getUserCached(note.userId, ctx);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ export class NoteConverter {
|
||||||
}
|
}
|
||||||
}) : null;
|
}) : null;
|
||||||
|
|
||||||
const renote = note.renote ?? (note.renoteId && recurse ? getNote(note.renoteId, user) : null);
|
const renote = note.renote ?? (note.renoteId && recurseCounter > 0 ? getNote(note.renoteId, user) : null);
|
||||||
|
|
||||||
const isBookmarked = user ? NoteFavorites.exist({
|
const isBookmarked = user ? NoteFavorites.exist({
|
||||||
where: {
|
where: {
|
||||||
|
@ -109,7 +109,7 @@ export class NoteConverter {
|
||||||
} as MastodonEntity.Tag;
|
} as MastodonEntity.Tag;
|
||||||
});
|
});
|
||||||
|
|
||||||
const reblog = Promise.resolve(renote).then(renote => recurse && renote ? this.encode(renote, ctx, false) : null);
|
const reblog = Promise.resolve(renote).then(renote => recurseCounter > 0 && renote ? this.encode(renote, ctx, isQuote(renote) && !isQuote(note) ? --recurseCounter : 0) : null);
|
||||||
|
|
||||||
// noinspection ES6MissingAwait
|
// noinspection ES6MissingAwait
|
||||||
return await awaitAll({
|
return await awaitAll({
|
||||||
|
|
Loading…
Reference in a new issue