fix(bulkReceive): honour admin email toggle and ISetting notification defaults#2562
Open
miaulalala wants to merge 2 commits intomasterfrom
Open
fix(bulkReceive): honour admin email toggle and ISetting notification defaults#2562miaulalala wants to merge 2 commits intomasterfrom
miaulalala wants to merge 2 commits intomasterfrom
Conversation
… defaults bulkReceive() bypassed UserSettings::getUserSetting() in favour of raw IUserConfig::getValuesByUsers() calls, losing two guards that exist in the single-user receive() path: 1. The admin enable_email toggle was never checked, so activity emails were queued for all users even when an admin had globally disabled them. 2. When canChangeNotification() is false the per-user push settings map was never populated, leaving $notificationSetting as null. Because null !== false evaluates to true, push notifications fired unconditionally for every affected user regardless of ISetting::isDefaultEnabledNotification(). Fix: add the enable_email guard before querying per-user email prefs, and derive a $defaultPushEnabled from ISetting so the fallback mirrors what getUserSetting() returns when canModifySetting() is false. AI-Assisted-By: claude-sonnet-4-6 Signed-off-by: Anna Larch <anna@nextcloud.com>
…ation fixes - Inject IConfig mock into Consumer constructor (6th arg added by fix) - Update testBulkReceiveNoMailWhenSettingDisabled: notification must not fire when isDefaultEnabledNotification() returns false (old test encoded the null !== false bug) - Update testBulkReceiveMultipleUsersWithMixedSettings: only users with an explicit true DB entry get a notification; absent entries now fall back to isDefaultEnabledNotification() instead of always sending - Update testBulkReceiveWithISetting: ISetting (non-ActivitySettings) now yields defaultPushEnabled=false, so no notification is sent - Add testBulkReceiveNoMailWhenAdminEmailDisabled: verifies that when the admin sets enable_email=no, getValuesByUsers is never called and no mail is queued even if the activity type has mail enabled by default AI-Assisted-By: claude-sonnet-4-6 Signed-off-by: Anna Larch <anna@nextcloud.com>
4b21461 to
eb8f9a4
Compare
Activity
|
||||||||||||||||||||||||||||
| Project |
Activity
|
| Branch Review |
fix/bulk-receive-email-notification-bypass
|
| Run status |
|
| Run duration | 01m 58s |
| Commit |
|
| Committer | Anna |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
1
|
|
|
0
|
|
|
9
|
| View all changes introduced in this branch ↗︎ | |
Collaborator
Author
|
/backport to stable33 |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Email bug (main issue, stable33+master):
bulkReceive()was querying per-user email settings viaIUserConfig::getValuesByUsers()— a raw DB query with no knowledge of the adminenable_emailtoggle. This caused activity emails to be sent to all users even when an admin had globally disabled them. Added the sameenable_emailguard that already exists inUserSettings::getUserSetting()andfilterUsersBySetting().Notification bug: When
canChangeNotification()isfalse,$userPushSettingswas leftnull, making$notificationSettingresolve tonull. The guardnull !== falseis always true, so push notifications fired unconditionally. Fixed by deriving$defaultPushEnabledfromISetting::isDefaultEnabledNotification()and using it as the authoritative value when the user cannot change the setting.Test plan
composer test:unitpasses (326 tests, 1580 assertions)testBulkReceiveNoMailWhenAdminEmailDisabledverifies thatgetValuesByUsersis never called and no mail is queued whenenable_email=no🤖 Generated with Claude Code