diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-05-31 13:06:40 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2021-05-31 13:06:40 +0900 |
| commit | 929e5455149fd770c53dc03dabd9572f586772c1 (patch) | |
| tree | c34d7f85b0a7b324f412b2a6bb4168574da30f6f /src/server/api/endpoints/i | |
| parent | Merge branch 'develop' (diff) | |
| parent | 12.82.0 (diff) | |
| download | misskey-929e5455149fd770c53dc03dabd9572f586772c1.tar.gz misskey-929e5455149fd770c53dc03dabd9572f586772c1.tar.bz2 misskey-929e5455149fd770c53dc03dabd9572f586772c1.zip | |
Merge branch 'develop'
Diffstat (limited to 'src/server/api/endpoints/i')
| -rw-r--r-- | src/server/api/endpoints/i/notifications.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/server/api/endpoints/i/notifications.ts b/src/server/api/endpoints/i/notifications.ts index b481fdba8f..a10dc09df3 100644 --- a/src/server/api/endpoints/i/notifications.ts +++ b/src/server/api/endpoints/i/notifications.ts @@ -5,6 +5,7 @@ import define from '../../define'; import { makePaginationQuery } from '../../common/make-pagination-query'; import { Notifications, Followings, Mutings, Users } from '../../../../models'; import { notificationTypes } from '../../../../types'; +import read from '@/services/note/read'; export const meta = { desc: { @@ -103,9 +104,9 @@ export default define(meta, async (ps, user) => { query.setParameters(followingQuery.getParameters()); } - if (ps.includeTypes?.length > 0) { + if (ps.includeTypes && ps.includeTypes.length > 0) { query.andWhere(`notification.type IN (:...includeTypes)`, { includeTypes: ps.includeTypes }); - } else if (ps.excludeTypes?.length > 0) { + } else if (ps.excludeTypes && ps.excludeTypes.length > 0) { query.andWhere(`notification.type NOT IN (:...excludeTypes)`, { excludeTypes: ps.excludeTypes }); } @@ -116,5 +117,11 @@ export default define(meta, async (ps, user) => { readNotification(user.id, notifications.map(x => x.id)); } + const notes = notifications.filter(notification => ['mention', 'reply', 'quote'].includes(notification.type)).map(notification => notification.note!); + + if (notes.length > 0) { + read(user.id, notes); + } + return await Notifications.packMany(notifications, user.id); }); |