summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-06-03 15:21:42 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-06-03 15:21:42 -0400
commitc3ba1396559147d149b99970d9a26af670d49165 (patch)
tree6c12f65afb92c1bc534300ecc123615f925b6e4b /packages/backend/src/server/api
parentcopy changes to global-timeline.ts (diff)
downloadsharkey-c3ba1396559147d149b99970d9a26af670d49165.tar.gz
sharkey-c3ba1396559147d149b99970d9a26af670d49165.tar.bz2
sharkey-c3ba1396559147d149b99970d9a26af670d49165.zip
copy changes to local-timeline.ts
Diffstat (limited to 'packages/backend/src/server/api')
-rw-r--r--packages/backend/src/server/api/endpoints/notes/local-timeline.ts46
1 files changed, 29 insertions, 17 deletions
diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts
index f55853f3f3..360528eaed 100644
--- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts
+++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts
@@ -103,13 +103,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
withFiles: ps.withFiles,
withReplies: ps.withReplies,
withBots: ps.withBots,
+ withRenotes: ps.withRenotes,
}, me);
- process.nextTick(() => {
- if (me) {
+ if (me) {
+ process.nextTick(() => {
this.activeUsersChart.read(me);
- }
- });
+ });
+ }
return await this.noteEntityService.packMany(timeline, me);
}
@@ -136,14 +137,15 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
withFiles: ps.withFiles,
withReplies: ps.withReplies,
withBots: ps.withBots,
+ withRenotes: ps.withRenotes,
}, me),
});
- process.nextTick(() => {
- if (me) {
+ if (me) {
+ process.nextTick(() => {
this.activeUsersChart.read(me);
- }
- });
+ });
+ }
return timeline;
});
@@ -156,26 +158,38 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
withFiles: boolean,
withReplies: boolean,
withBots: boolean,
+ withRenotes: boolean,
}, me: MiLocalUser | null) {
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'),
ps.sinceId, ps.untilId)
- .andWhere('(note.visibility = \'public\') AND (note.userHost IS NULL) AND (note.channelId IS NULL)')
+ .andWhere('note.visibility = \'public\'')
+ .andWhere('note.channelId IS NULL')
+ .andWhere('note.userHost IS NULL')
.innerJoinAndSelect('note.user', 'user')
.leftJoinAndSelect('note.reply', 'reply')
.leftJoinAndSelect('note.renote', 'renote')
- .leftJoinAndSelect('reply.user', 'replyUser')
- .leftJoinAndSelect('renote.user', 'renoteUser');
+ .leftJoinAndSelect('reply.user', 'replyUser', 'replyUser.id = note.replyUserId')
+ .leftJoinAndSelect('renote.user', 'renoteUser', 'renoteUser.id = note.renoteUserId');
- this.queryService.generateVisibilityQuery(query, me);
this.queryService.generateBlockedHostQueryForNote(query);
- if (me) this.queryService.generateMutedUserQueryForNotes(query, me);
- if (me) this.queryService.generateBlockedUserQueryForNotes(query, me);
- if (me) this.queryService.generateMutedUserRenotesQueryForNotes(query, me);
+ this.queryService.generateSilencedUserQueryForNotes(query, me);
+ if (me) {
+ this.queryService.generateMutedUserQueryForNotes(query, me);
+ this.queryService.generateBlockedUserQueryForNotes(query, me);
+ }
if (ps.withFiles) {
query.andWhere('note.fileIds != \'{}\'');
}
+ if (!ps.withBots) query.andWhere('user.isBot = FALSE');
+
+ if (!ps.withRenotes) {
+ this.queryService.generateExcludedRenotesQueryForNotes(query);
+ } else if (me) {
+ this.queryService.generateMutedUserRenotesQueryForNotes(query, me);
+ }
+
if (!ps.withReplies) {
query.andWhere(new Brackets(qb => {
qb
@@ -188,8 +202,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}));
}
- if (!ps.withBots) query.andWhere('user.isBot = FALSE');
-
return await query.limit(ps.limit).getMany();
}
}