Describe the issue or problem
A user got registered as Reader in journal A. When the user has a blocked_email_notification in journal B, the user does not get notifications for new issues in journal A.
Steps I took leading up to the issue
- Freshly registered account, Reader role in journal A only, no rows in
notification_subscription_settings - Publish an issue in A → notification created, email sent.
- Insert a block for journal B, where the account has no role:
INSERT INTO notification_subscription_settings (setting_name, setting_value, user_id, context_id, setting_type) VALUES ('blocked_emailed_notification', '268435477', <user>, <journal B>, 'int'); - Publish an issue in A → notification created, user gets no email.
- Delete the block. Publish in A → notification and the user gets an email again.
What application are you using?
OJS 3.5.0.5, PHP 8.4, MariaDB, 55 currently enabled journals in one installation.
Additional information
From my AI helper:
PKP\notification\NotificationSubscriptionSettingsDAO::getSubscribedUserIds() filters the role lookup by context (whereExists block, COALESCE(ug.context_id, 0) against $contextIds) but the subquery that excludes blocked users has no context_id condition at all:
php
->whereNotIn('u.user_id',
fn (Builder $q) => $q->select('nss.user_id')
->from('notification_subscription_settings as nss')
->whereIn('setting_name', $blockedNotificationKey)
->whereIn('setting_value', $blockedNotificationType)
)