diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-09-06 20:54:49 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2022-09-06 20:54:49 +0900 |
| commit | 1b014bc3e5b11cf153207df461a5cf0095ab5ea7 (patch) | |
| tree | df37fc7693398f3b82fdd507360cebe98eb52dbc /packages/backend/src/server/api/common | |
| parent | refactor(client): refactor file name and directory structure (diff) | |
| download | sharkey-1b014bc3e5b11cf153207df461a5cf0095ab5ea7.tar.gz sharkey-1b014bc3e5b11cf153207df461a5cf0095ab5ea7.tar.bz2 sharkey-1b014bc3e5b11cf153207df461a5cf0095ab5ea7.zip | |
fix(server): 他人の通知を既読にできる可能性があるのを修正
Diffstat (limited to 'packages/backend/src/server/api/common')
| -rw-r--r-- | packages/backend/src/server/api/common/read-notification.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/backend/src/server/api/common/read-notification.ts b/packages/backend/src/server/api/common/read-notification.ts index cf993ade3e..b0d38a9e39 100644 --- a/packages/backend/src/server/api/common/read-notification.ts +++ b/packages/backend/src/server/api/common/read-notification.ts @@ -1,18 +1,19 @@ +import { In } from 'typeorm'; import { publishMainStream } from '@/services/stream.js'; import { pushNotification } from '@/services/push-notification.js'; import { User } from '@/models/entities/user.js'; import { Notification } from '@/models/entities/notification.js'; import { Notifications, Users } from '@/models/index.js'; -import { In } from 'typeorm'; export async function readNotification( userId: User['id'], - notificationIds: Notification['id'][] + notificationIds: Notification['id'][], ) { if (notificationIds.length === 0) return; // Update documents const result = await Notifications.update({ + notifieeId: userId, id: In(notificationIds), isRead: false, }, { @@ -27,7 +28,7 @@ export async function readNotification( export async function readNotificationByQuery( userId: User['id'], - query: Record<string, any> + query: Record<string, any>, ) { const notificationIds = await Notifications.findBy({ ...query, |