diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-10-09 12:44:19 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2021-10-09 12:44:19 +0900 |
| commit | ec05c073217a0c754032ac92de9d91fe03808dd0 (patch) | |
| tree | 76449b8661fc73f696dbad12cb9f4669b4f6e37e /src/server/api/endpoints | |
| parent | tweak ui (diff) | |
| download | sharkey-ec05c073217a0c754032ac92de9d91fe03808dd0.tar.gz sharkey-ec05c073217a0c754032ac92de9d91fe03808dd0.tar.bz2 sharkey-ec05c073217a0c754032ac92de9d91fe03808dd0.zip | |
feat: 未読の通知のみ表示する機能
Diffstat (limited to 'src/server/api/endpoints')
| -rw-r--r-- | src/server/api/endpoints/i/notifications.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/server/api/endpoints/i/notifications.ts b/src/server/api/endpoints/i/notifications.ts index 3c265a10c1..0c5586054f 100644 --- a/src/server/api/endpoints/i/notifications.ts +++ b/src/server/api/endpoints/i/notifications.ts @@ -33,6 +33,11 @@ export const meta = { default: false }, + unreadOnly: { + validator: $.optional.bool, + default: false + }, + markAsRead: { validator: $.optional.bool, default: true @@ -105,6 +110,10 @@ export default define(meta, async (ps, user) => { query.andWhere(`notification.type NOT IN (:...excludeTypes)`, { excludeTypes: ps.excludeTypes }); } + if (ps.unreadOnly) { + query.andWhere(`notification.isRead = false`); + } + const notifications = await query.take(ps.limit!).getMany(); // Mark all as read |