Benachrichtigung bei neuem Kommentar auf Einkaufslisten-/Vorratsschrank-/Masterpack-Produkten #185
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#185
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 bei neuem Kommentar auf Einkaufslisten-/Vorratsschrank-/Masterpack-Produkten
As a Mitglied, das zuvor selbst auf einem Einkaufslisten-, Vorratsschrank- oder Masterpackprodukt kommentiert hat,
I want to benachrichtigt zu werden, wenn danach jemand anderes auf demselben Produkt/Item kommentiert,
so that ich eine Diskussion (z. B. "welche Marke genau?", "brauchen wir das wirklich?") nicht verpasse, ohne die Liste staendig manuell zu pruefen.
Kontext (verifiziert im Code): Kommentare existieren bereits auf Einkaufslisten-Produkten (#179), Vorratsschrank-Produkten (#101c) und Masterpack-Items (bereits im urspruenglichen #101/#93-Umfang). Fuer Todos gibt es bereits eine Kommentar-Benachrichtigung (#163,
CreateCommentCommandHandler.cs,NotificationKind.TodoCommented) - die aber am Todo-Assigneehaengt, den es fuer Einkaufslisten-/Vorratsschrank-/Masterpack-Produkte nicht gibt (dort gibt es keine Einzel-Zuweisung, nur Listen-Mitgliedschaft).Design-Entscheidung (aufgeloest, kein Eskalationsbedarf): Da es kein Assignee-Aequivalent gibt, benachrichtigt diese Story stattdessen alle bisherigen Kommentatoren desselben Produkts/Items (auszer dem Autor des neuen Kommentars) - dasselbe "Teilnehmer eines Threads" Muster, das z. B. GitHub Issue-Kommentare verwenden. Kein Benachrichtigen aller Listenmitglieder pauschal (das waere zu viel Rauschen fuer Listen mit vielen Mitgliedern und passt nicht zum bestehenden Opt-in-artigen Charakter von #163).
Acceptance criteria:
NotificationKind-Werte fuer Shopping-/Pantry-/MasterPack-Produktkommentare (analog zuTodoCommented).CreateNotificationCommand-Infrastruktur, kein neuer Versandweg.Out of scope for this story:
Open questions: (escalate to human if unanswered)
Claiming this. Plan (resolves a structural question the design note above did not anticipate):
NotificationEntity's target was already generalized from a hard Todo-only FK to a two-way Todo/Pantry nullable-FK model by #186. Extending that same generalization to a 4-way exactly-one-of (Todo/Pantry/Shopping/MasterPacking), rather than inventing a separate notification path, soShoppingProductCommented/PantryProductCommented/MasterPackItemCommentedreuse the existingNotificationDto/WS-publish/notification-panel infrastructure end to end. Each of the three CreateXCommentCommandHandlers gets a small NotifyPriorCommentersAsync step after inserting the new comment: query distinct prior commenters on that product/item (excluding the current author), insert one notification per recipient targeting the owning list, publish via the existing notificationSubject. No idempotency index needed (unlike #186's recurring sweep) since this is a one-shot event per comment, not a sweep.Implemented and merged (commits
c086a729,8b90bc64).Scope: Notifies a user when someone else comments on a Shopping-list product, Pantry product, or Master Packing item they previously commented on themselves - a "thread participants" model, since these list types have no per-item assignee unlike Todos (#163's TodoCommented).
Backend:
NotificationEntity's target FK, already generalized Todo→Todo/Pantry by #186, widened to a 4-way Todo/Pantry/Shopping/MasterPacking model (nullable FK columns + widenedCK_NotificationEntity_ExactlyOneTargetcheck constraint).NotificationKindvalues:ShoppingProductCommented,PantryProductCommented,MasterPackItemCommented.NotificationDto/notification query+command handlers extended with the two new target id/title pairs.Frontend:
NotificationItemnavigation and title-line rendering extended to cover the two new target types.Tests: 15 new backend tests across the three comment-handler test files (notify-on-comment, no-self-notify, no-notify-on-first-comment) plus a new
CreateMasterPackItemCommentCommandHandlerTests.csfile; frontend fixtures/tests extended for the new DTO fields and navigation cases. Full suite green: 1117 backend tests (946+52+119), 1324 frontend tests (136 files).Key decision: reused the existing
notificationSubject/manualNotificationEntityconstruction pattern (as #186's Pantry-due-notification handlers already do) rather than the sharedCreateNotificationCommand, since that command is still hard-tied toTodoListIdonly and wasn't in scope to generalize here.