Benachrichtigung, wenn ein Mitglied aus einer Liste entfernt wird #168
Labels
No labels
priority/could
priority/must
priority/should
priority/wont
status/blocked
status/claimed
status/done-migrated
type/bug
type/feature
type/infra
type/tech-debt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
robert/todo#168
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Story: Benachrichtigung, wenn ein Mitglied aus einer Liste entfernt wird
As a Mitglied, das von einer geteilten Liste entfernt wird,
I want to eine Benachrichtigung darueber erhalten,
so that ich nicht raetseln muss, warum eine Liste ploetzlich aus meiner Uebersicht verschwunden ist.
Background
NotificationKind.AddedToListbenachrichtigt bereits symmetrisch, wenn jemand einer Liste hinzugefuegt wird (#26). Es gibt aber keine Gegenstelle fuer den Entfernt-Fall:RemoveTodoListMemberCommandHandler.cs(und die entsprechenden Handler fuer Shopping-/Masterpackliste) loesen aktuell keineCreateNotificationCommandaus - das Mitglied merkt nur indirekt, dass die Liste aus der Sidebar verschwunden ist.Acceptance criteria:
Remove*ListMemberCommandaus einer Todo-, Einkaufs- oder Masterpackliste entfernt, erhaelt es eine Benachrichtigung (neuerNotificationKind.RemovedFromList) nach dem bestehenden Muster.AddedToLists „You were added to 'X'" - hier „You were removed from 'X'").Out of scope for this story:
Open questions: (escalate to human if unanswered)
Claiming this. Plan: add a new
NotificationKind.RemovedFromList, and callCreateNotificationCommandfromRemoveTodoListMemberCommandHandler.csplus the Shopping/MasterPacking equivalents, mirroringAcceptListInvitationCommandHandler's existingAddedToListnotification (body: "You were removed from 'X'", no actor name, matching that convention). Self-removal via #121'sLeave*ListCommandhandlers is a separate command family and stays untouched - no notification there, per the AC. Pantry is out of scope (no independent membership per #94). No open questions on the issue itself, so proceeding directly to implementation.Scope correction found during implementation:
NotificationEntity.TodoListIdhas a hard EF Core FK constraint toTodoListEntityspecifically (Checkly/Entities/NotificationEntity.cs) - it cannot reference aShoppingListId/MasterPackingListIdwithout a real schema change (a nullable list-type discriminator + separate nullable FK columns, or dropping the DB-level FK entirely). This isn't something #163 or this story introduced - it's a pre-existing limitation, confirmed by the fact thatNotificationKind.AddedToList(the direct precedent for this story) is also already Todo-list-only in practice:AcceptShoppingListInvitationCommandHandler.csandAcceptMasterPackingListInvitationCommandHandler.csnever callCreateNotificationCommandat all today, only the Todo-list equivalent does.Narrowing this story's scope to Todo lists only, matching
AddedToList's own existing scope exactly (symmetry, not a regression) - Shopping/MasterPacking removal notifications would need a real notification-schema-generalization story of their own first, which is a materially bigger change than this issue's AC anticipated. Proceeding with the Todo-list implementation now.Implemented and merged in commit
cc580f9eon master.Scope correction (see the earlier comment above for the full reasoning): narrowed to Todo lists only.
NotificationEntity.TodoListIdhas a hard FK toTodoListEntityspecifically, so it cannot reference aShoppingListId/MasterPackingListIdwithout a real schema generalization - and the direct precedent this story mirrors,NotificationKind.AddedToList, is already Todo-list-only in practice (neitherAcceptShoppingListInvitationCommandHandlernorAcceptMasterPackingListInvitationCommandHandlerever callsCreateNotificationCommand). This is symmetry with existing behavior, not a regression - extending bothAddedToListand this new kind to Shopping/MasterPacking would need its own dedicated story to generalize the notification schema first.Implementation:
RemoveTodoListMemberCommandHandlernow fires aNotificationKind.RemovedFromListnotification for the removed member after the membership is deleted, mirroringAddedToList's exact wording convention ("You were removed from 'X'", no actor name). Self-removal viaLeaveTodoListCommand(#121) is untouched - the leaving member already knows, per the AC.Tests: 1 new backend unit test verifying the notification is created with the correct body/list/read-state, confirmed to reach the expected
DockerUnavailableExceptionin this sandbox (all 8 tests in the file, including the 7 pre-existing ones, reach the same point - proving DI wiring is correct).Verification:
dotnet buildclean; full frontend suite unchanged and green (126 files/1182 tests) sinceNotificationItem.tsxrendersbody/kindgenerically with no per-kind branching - only an additive TS union member was needed. A dedicated security-review pass confirmed no IDOR (recipient is validated as an actual list member before the notification fires, and the command stays owner-only), no injection issue (same plain-text body pattern as the already-shipped notification kinds), and confirmed the membership-delete-before-notification ordering is safe (the list re-fetch authorizes the acting owner, not the removed member, so it can't throw or return a stale title).Closing as done.