[mastodon-client] Further improve query performance

This commit is contained in:
Laura Hausmann 2023-09-25 22:48:16 +02:00
parent 455c249f3d
commit d9ec53db4c
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605
3 changed files with 1 additions and 5 deletions

View File

@ -53,7 +53,6 @@ export class NoteConverter {
}
}) : null;
const reply = note.reply ?? (note.replyId ? getNote(note.replyId, user) : null);
const renote = note.renote ?? (note.renoteId ? getNote(note.renoteId, user) : null);
const isBookmarked = user ? NoteFavorites.exist({
@ -92,7 +91,7 @@ export class NoteConverter {
url: note.uri ? note.uri : `https://${config.host}/notes/${note.id}`,
account: Promise.resolve(noteUser).then(p => UserConverter.encode(p, cache)),
in_reply_to_id: note.replyId,
in_reply_to_account_id: Promise.resolve(reply).then(reply => reply?.userId ?? null),
in_reply_to_account_id: note.replyUserId,
reblog: Promise.resolve(renote).then(renote => renote && note.text === null ? this.encode(renote, user, cache) : null),
content: Promise.resolve(text).then(text => text !== null ? toHtml(mfm.parse(text), JSON.parse(note.mentionedRemoteUsers)) ?? escapeMFM(text) : ""),
text: text,

View File

@ -34,7 +34,6 @@ export class TimelineHelpers {
qb.orWhere(`note.userId IN (:...followingIds)`, {followingIds: followingIds});
}),
)
.leftJoinAndSelect("note.reply", "reply")
.leftJoinAndSelect("note.renote", "renote");
generateChannelQuery(query, user);
@ -77,7 +76,6 @@ export class TimelineHelpers {
if (!local) query.andWhere("note.channelId IS NULL");
query
.leftJoinAndSelect("note.reply", "reply")
.leftJoinAndSelect("note.renote", "renote");
generateRepliesQuery(query, true, user);

View File

@ -51,7 +51,6 @@ export class UserHelpers {
if (excludeReblogs) query.andWhere("(note.renoteId IS NOT NULL) OR (note.text IS NOT NULL)");
query
.leftJoinAndSelect("note.reply", "reply")
.leftJoinAndSelect("note.renote", "renote");
//FIXME this doesn't exclude replies to your own reply to someone else's post