Skip to content

fix(bulkReceive): honour admin email toggle and ISetting notification defaults#2562

Open
miaulalala wants to merge 1 commit into
masterfrom
fix/bulk-receive-email-notification-bypass
Open

fix(bulkReceive): honour admin email toggle and ISetting notification defaults#2562
miaulalala wants to merge 1 commit into
masterfrom
fix/bulk-receive-email-notification-bypass

Conversation

@miaulalala
Copy link
Copy Markdown
Collaborator

@miaulalala miaulalala commented May 6, 2026

Summary

  • Email bug (main issue, stable33+master): bulkReceive() was querying per-user email settings via IUserConfig::getValuesByUsers() — a raw DB query with no knowledge of the admin enable_email toggle. This caused activity emails to be sent to all users even when an admin had globally disabled them. Added the same enable_email guard that already exists in UserSettings::getUserSetting() and filterUsersBySetting().

  • Notification bug: When canChangeNotification() is false, $userPushSettings was left null, making $notificationSetting resolve to null. The guard null !== false is always true, so push notifications fired unconditionally. Fixed by deriving $defaultPushEnabled from ISetting::isDefaultEnabledNotification() and using it as the authoritative value when the user cannot change the setting.

Test plan

  • composer test:unit passes (326 tests, 1580 assertions)
  • New test testBulkReceiveNoMailWhenAdminEmailDisabled verifies that getValuesByUsers is never called and no mail is queued when enable_email=no
  • Updated tests confirm corrected notification behaviour for non-user-configurable activity types
  • Backport to stable33 via GitHub

🤖 Generated with Claude Code

@miaulalala miaulalala requested a review from nickvergessen May 6, 2026 10:51
@miaulalala miaulalala self-assigned this May 6, 2026
@miaulalala miaulalala added this to the Nextcloud 34 milestone May 6, 2026
@miaulalala miaulalala force-pushed the fix/bulk-receive-email-notification-bypass branch from 4b21461 to eb8f9a4 Compare May 6, 2026 10:53
@cypress
Copy link
Copy Markdown

cypress Bot commented May 6, 2026

Activity    Run #3754

Run Properties:  status check failed Failed #3754  •  git commit 664f85f524: fix(bulkReceive): honour admin email toggle and ISetting notification defaults
Project Activity
Branch Review fix/bulk-receive-email-notification-bypass
Run status status check failed Failed #3754
Run duration 02m 28s
Commit git commit 664f85f524: fix(bulkReceive): honour admin email toggle and ISetting notification defaults
Committer Anna
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 1
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 8
View all changes introduced in this branch ↗︎

Tests for review

Failed  cypress/e2e/settings.cy.ts • 1 failed test • Run E2E

View Output

Test Artifacts
Check that user's settings survive a reload > Form survive a reload Test Replay Screenshots

@miaulalala
Copy link
Copy Markdown
Collaborator Author

/backport to stable33

Comment thread lib/Consumer.php Outdated
@miaulalala miaulalala force-pushed the fix/bulk-receive-email-notification-bypass branch from eb8f9a4 to 4b22d47 Compare May 13, 2026 13:46
@miaulalala miaulalala requested a review from come-nc May 13, 2026 13:47
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

… defaults

The admin Enable notification emails toggle was not checked in
bulkReceive(), so emails could be queued even when the toggle was
disabled. Also, ISetting-based settings that do not implement
ActivitySettings had canChangeNotification() called on them, which
caused a fatal error; the default push-enabled state was also ignored.

Injects IAppConfig and uses getValueString() to check the toggle,
consistent with the approach used elsewhere. ISetting instances that are
not ActivitySettings now fall back to the setting default via
isDefaultEnabledNotification() without calling canChangeNotification().

AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Anna Larch <anna@nextcloud.com>
@miaulalala miaulalala force-pushed the fix/bulk-receive-email-notification-bypass branch 2 times, most recently from 4b22d47 to b770f9d Compare May 13, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants