[mastodon-client] Further improve query performance
This commit is contained in:
parent
455c249f3d
commit
d9ec53db4c
3 changed files with 1 additions and 5 deletions
|
|
@ -53,7 +53,6 @@ export class NoteConverter {
|
||||||
}
|
}
|
||||||
}) : null;
|
}) : null;
|
||||||
|
|
||||||
const reply = note.reply ?? (note.replyId ? getNote(note.replyId, user) : null);
|
|
||||||
const renote = note.renote ?? (note.renoteId ? getNote(note.renoteId, user) : null);
|
const renote = note.renote ?? (note.renoteId ? getNote(note.renoteId, user) : null);
|
||||||
|
|
||||||
const isBookmarked = user ? NoteFavorites.exist({
|
const isBookmarked = user ? NoteFavorites.exist({
|
||||||
|
|
@ -92,7 +91,7 @@ export class NoteConverter {
|
||||||
url: note.uri ? note.uri : `https://${config.host}/notes/${note.id}`,
|
url: note.uri ? note.uri : `https://${config.host}/notes/${note.id}`,
|
||||||
account: Promise.resolve(noteUser).then(p => UserConverter.encode(p, cache)),
|
account: Promise.resolve(noteUser).then(p => UserConverter.encode(p, cache)),
|
||||||
in_reply_to_id: note.replyId,
|
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),
|
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) : ""),
|
content: Promise.resolve(text).then(text => text !== null ? toHtml(mfm.parse(text), JSON.parse(note.mentionedRemoteUsers)) ?? escapeMFM(text) : ""),
|
||||||
text: text,
|
text: text,
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ export class TimelineHelpers {
|
||||||
qb.orWhere(`note.userId IN (:...followingIds)`, {followingIds: followingIds});
|
qb.orWhere(`note.userId IN (:...followingIds)`, {followingIds: followingIds});
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.leftJoinAndSelect("note.reply", "reply")
|
|
||||||
.leftJoinAndSelect("note.renote", "renote");
|
.leftJoinAndSelect("note.renote", "renote");
|
||||||
|
|
||||||
generateChannelQuery(query, user);
|
generateChannelQuery(query, user);
|
||||||
|
|
@ -77,7 +76,6 @@ export class TimelineHelpers {
|
||||||
if (!local) query.andWhere("note.channelId IS NULL");
|
if (!local) query.andWhere("note.channelId IS NULL");
|
||||||
|
|
||||||
query
|
query
|
||||||
.leftJoinAndSelect("note.reply", "reply")
|
|
||||||
.leftJoinAndSelect("note.renote", "renote");
|
.leftJoinAndSelect("note.renote", "renote");
|
||||||
|
|
||||||
generateRepliesQuery(query, true, user);
|
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)");
|
if (excludeReblogs) query.andWhere("(note.renoteId IS NOT NULL) OR (note.text IS NOT NULL)");
|
||||||
|
|
||||||
query
|
query
|
||||||
.leftJoinAndSelect("note.reply", "reply")
|
|
||||||
.leftJoinAndSelect("note.renote", "renote");
|
.leftJoinAndSelect("note.renote", "renote");
|
||||||
|
|
||||||
//FIXME this doesn't exclude replies to your own reply to someone else's post
|
//FIXME this doesn't exclude replies to your own reply to someone else's post
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue