Skip to content

fix: emit collection notification events only after successful operations#2429

Merged
ydkmlt84 merged 9 commits into
Maintainerr:mainfrom
enoch85:fix/notification-before-collection-action
Feb 28, 2026
Merged

fix: emit collection notification events only after successful operations#2429
ydkmlt84 merged 9 commits into
Maintainerr:mainfrom
enoch85:fix/notification-before-collection-action

Conversation

@enoch85

@enoch85 enoch85 commented Feb 27, 2026

Copy link
Copy Markdown
Collaborator

What issue is solved

Issue #2412 — users receive repeated notifications about the same media being added to collections every rule run cycle.

How

Previously, CollectionMedia_Added / CollectionMedia_Removed events were emitted before the actual add/remove operations ran. If the media server rejected an item (e.g. HTTP 400), the notification was already sent but the item was never recorded in the DB — causing it to be retried and re-notified on every subsequent rule run.

The fix:

  • Moves event emissions to after the operations complete
  • Queries the DB to determine which items actually succeeded
  • Only emits events for items that were truly added/removed
  • Narrows the manual sync removal to only isManual items, preventing rule-added items from being incorrectly removed during media server sync

@enoch85 enoch85 requested a review from ydkmlt84 as a code owner February 27, 2026 21:58
@enoch85 enoch85 force-pushed the fix/notification-before-collection-action branch from c2e84cc to 48f300c Compare February 27, 2026 22:01
…ions

Move CollectionMedia_Added/Removed event emissions to after the actual
addToCollection/removeFromCollection calls and verify against DB state.
Only items that were actually added or removed trigger notifications.

Also narrow manual sync removal to only isManual items, preventing
rule-added items from being incorrectly removed during media server sync.

Fixes Maintainerr#2412
@enoch85 enoch85 force-pushed the fix/notification-before-collection-action branch from 48f300c to 59a6499 Compare February 27, 2026 22:16
@enoch85 enoch85 self-assigned this Feb 27, 2026
@enoch85 enoch85 mentioned this pull request Feb 27, 2026
enoch85 added a commit that referenced this pull request Feb 28, 2026
PR #2396 - feat(settings): unify connection-test error handling across services
- Added shared backend/frontend error helpers for connection tests
- Reduced connection test timeout to 3s and parallelized tests
- Normalized user-facing error messages across all service test endpoints

PR #2429 - fix: emit collection notification events only after successful operations
- Moved event emissions to after operations complete
- Only emits events for items that were truly added/removed
- Pass touchedMediaServerIds to prevent incorrect removals during sync

PR #2436 - fix(server): resolve Seerr addUser returning NULL
- Use username fields directly from Seerr API response instead of media server ID lookup
- Use workspace-local typeorm migration cli
- Use initial setup terminology for media server success log
- Added 11 unit tests for addUser covering all user types and edge cases
@ydkmlt84 ydkmlt84 merged commit d0a11e9 into Maintainerr:main Feb 28, 2026
9 checks passed
@enoch85 enoch85 deleted the fix/notification-before-collection-action branch February 28, 2026 19:09
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.0.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants