summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/notes
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-07 14:02:05 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-10-07 14:02:05 +0900
commit0fe8c0134c32b060e318da14d4ad4d1510b69d29 (patch)
treedec37280256420b318a9d90ef06b77c2e5891cfe /packages/backend/src/server/api/endpoints/notes
parentプライバシーポリシー・運営者情報のリンクを追加 (#11925) (diff)
downloadsharkey-0fe8c0134c32b060e318da14d4ad4d1510b69d29.tar.gz
sharkey-0fe8c0134c32b060e318da14d4ad4d1510b69d29.tar.bz2
sharkey-0fe8c0134c32b060e318da14d4ad4d1510b69d29.zip
enhance(backend): notes/global-timeline復活
Diffstat (limited to 'packages/backend/src/server/api/endpoints/notes')
-rw-r--r--packages/backend/src/server/api/endpoints/notes/global-timeline.ts33
1 files changed, 31 insertions, 2 deletions
diff --git a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts
index e5a86905d6..be7557c213 100644
--- a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts
+++ b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts
@@ -67,8 +67,37 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new ApiError(meta.errors.gtlDisabled);
}
- // TODO?
- return [];
+ //#region Construct query
+ const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'),
+ ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
+ .andWhere('note.visibility = \'public\'')
+ .andWhere('note.channelId IS NULL')
+ .innerJoinAndSelect('note.user', 'user')
+ .leftJoinAndSelect('note.reply', 'reply')
+ .leftJoinAndSelect('note.renote', 'renote')
+ .leftJoinAndSelect('reply.user', 'replyUser')
+ .leftJoinAndSelect('renote.user', 'renoteUser');
+
+ if (me) {
+ this.queryService.generateMutedUserQuery(query, me);
+ this.queryService.generateBlockedUserQuery(query, me);
+ this.queryService.generateMutedUserRenotesQueryForNotes(query, me);
+ }
+
+ if (ps.withFiles) {
+ query.andWhere('note.fileIds != \'{}\'');
+ }
+ //#endregion
+
+ const timeline = await query.limit(ps.limit).getMany();
+
+ process.nextTick(() => {
+ if (me) {
+ this.activeUsersChart.read(me);
+ }
+ });
+
+ return await this.noteEntityService.packMany(timeline, me);
});
}
}