Fix removing notifications from muted accounts

This commit is contained in:
Chocobozzz
2026-05-22 09:43:47 +02:00
parent 016eb9451b
commit c61b9ce3db
+3 -3
View File
@@ -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'
: ''