feat: 未読の通知のみ表示する機能

This commit is contained in:
syuilo
2021-10-09 12:44:19 +09:00
parent 27c056cbbf
commit ec05c07321
5 changed files with 39 additions and 6 deletions

View File

@@ -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