mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-03 01:08:05 +09:00
[mastodon-client] Further improve query performance
This commit is contained in:
parent
455c249f3d
commit
d9ec53db4c
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user