Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix removing notifications from muted accounts

Chocobozzzc61b9ce3db55
diff --git a/server/core/models/user/user-notification.ts b/server/core/models/user/user-notification.ts
index 834b77f867..d759497ac6 100644
--- a/server/core/models/user/user-notification.ts
+++ b/server/core/models/user/user-notification.ts
@@ -1,4 +1,4 @@
-import { forceNumber, maxBy } from '@peertube/peertube-core-utils'
+import { exists, forceNumber, maxBy } from '@peertube/peertube-core-utils'
import type { UserNotification, UserNotificationData, UserNotificationType_Type } from '@peertube/peertube-models'
import { uuidToShort } from '@peertube/peertube-node-utils'
import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user/index.js'
@@ -369,12 +369,12 @@ export class UserNotificationModel extends SequelizeModel<UserNotificationModel>
const id = forceNumber(options.id)
const bind: { id: number, forUserId?: number } = { id }
- if (options.forUserId !== undefined) {
+ if (exists(options.forUserId)) {
bind.forUserId = options.forUserId
}
function buildAccountWhereQuery (base: string) {
- const whereSuffix = options.forUserId !== undefined
+ const whereSuffix = exists(options.forUserId)
? ' AND "userNotification"."userId" = $forUserId'
: ''