Repository navigation
Conversation
Milestone plan for a junior developer: every notification is found-or-created into a Huddle conversation topic by teamId + topicKey, unread counts per topic, the real app-icon badge, and the Catch up view. Each milestone is one PR with checkboxes.
🚀 Preview Deployment Ready
Preview auto-deletes when this PR is closed. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The plan omits required audience restrictions for recipient-only notices and contains unresolved routing, reminder-action, and unread-state errors.
9 open issues
Use the supported Huddle conversation parameter and thread ID · New Place helper tests where backend Vitest discovers them · New Restrict notice visibility to the updated topic's audience · New Post once per distinct topic key for multi-recipient events · New Use the agreement handler that schedules the agreed clockout · New Mark conversations read only when visible; reserve bulk reads for Catch up · New Sync the badge after every mutation that changes unread counts · New Exclude muted teams from unread counts across all notification surfaces · New Associate legacy and topicless unread rows with reachable Catch up items · New
What changed in this PR
Adds a documentation-only implementation plan for #914, integrating notification topics, unread counts and Catch up into Huddle.
Changes:
- Defines topic routing, membership and in-topic actions.
- Plans synchronized unread counts, app badges and Catch up.
- Breaks delivery into milestones with verification steps and open decisions.
| File | Description |
|---|---|
docs/notification-topics-914-plan.md |
Adds the implementation roadmap, design decisions and validation checklist. |
Review effort: Balanced
|
|
||
| **Why:** Tapping a clock-out alert sometimes opens the profile Work tab instead of Huddle. `clockOutUrl` falls back to `/app/profile/<userId>?tab=work` when there's no session post. | ||
|
|
||
| - [ ] In `meteor-backend/server/notify-core.js`, change `clockOutUrl` so the fallback opens Huddle on the team's workday: `/app/huddle?teamId=<teamId>`, plus `&conversationId=<workdayId>` when known. Check `src/ui/ROUTING.md` for the exact param names Huddle reads. |
|
|
||
| ## Milestone 2 — Find-or-create topics (backend only, no visible change) | ||
|
|
||
| **Files:** new `meteor-backend/server/notification-topics-core.js` (pure) + `notification-topics-core.test.js`; new `meteor-backend/server/notification-topics.js` (database); `conversations.js` (index). |
| - [ ] **`deliverToTopic({ teamId, type, data, recipients, actorId, text })`** in `notification-topics.js`: | ||
| 1. `key = topicKeyFor(type, data, recipient)`. For ticket keys it is the same for every recipient. | ||
| 2. `findOrCreateTopic(...)` once per recipient (adds each to `memberIds`). | ||
| 3. Insert **one** notice post into `huddlePosts` for the event: `{ teamId, userId: actorId, conversationId, content: { text }, notice: { type, ref: { ticketId } }, ticketIds: [ticketId], createdAt }`. Use the same fields `createHuddlePost` writes. Look at the `doc` in `huddle.js` around line 932. |
|
|
||
| **Files:** `timesheet-change-requests.js`, `team-join-requests.js`, `teams.js`, `timers.js`, `notify-core.js`, `settings/notify.js`, `agenda.js`, client Huddle files. | ||
|
|
||
| - [ ] Switch every type in the table that has a `requests:` or `reminders:` key to `deliverToTopic`. Each personal topic gets **one** member, the recipient. |
Comment on lines
+188
to
+189
| - [ ] Shift reminder: **Clock out** / **Keep working** → `clock.respondShiftReminder` with the same `action` values the Notifications page sends today. | ||
| - [ ] After a click, show "Approved by you" / "Declined by you" / "You clocked out" / "You kept working", announced through `aria-live`. |
Comment on lines
+206
to
+209
| - [ ] Opening a conversation calls `markConversationRead`, and the count updates without a reload. Reuse the live `notifications.liveForUser` publication if it fits, and don't poll. | ||
| - [ ] The team picker menu shows each team's unread count. The Huddle nav item and the mobile tab show `total`. | ||
| - [ ] Tests for the aggregation (core function) and for "first read wins" staying true. | ||
| - [ ] Manual check: post from user B. User A sees the count go up, opens the topic, and it goes to 0 on web and phone. |
|
|
||
| - [ ] `push.js` line ~154: replace `note.badge = 1` with the user's unread total (`countDocuments({ userId, read: { $ne: true } })`), counted **after** the new notification is inserted. | ||
| - [ ] FCM: set `android.notification.notificationCount` to the same total. | ||
| - [ ] When notifications are marked read (`markOneRead`, `markAllRead`, `markConversationRead`, Catch up), send a **silent** APNs push (`contentAvailable: true`, `badge: <new total>`, no alert) to that user's iOS devices. Put this in one helper, `syncBadge(userId)`, and call it from all four. |
| - [ ] `push.js` line ~154: replace `note.badge = 1` with the user's unread total (`countDocuments({ userId, read: { $ne: true } })`), counted **after** the new notification is inserted. | ||
| - [ ] FCM: set `android.notification.notificationCount` to the same total. | ||
| - [ ] When notifications are marked read (`markOneRead`, `markAllRead`, `markConversationRead`, Catch up), send a **silent** APNs push (`contentAvailable: true`, `badge: <new total>`, no alert) to that user's iOS devices. Put this in one helper, `syncBadge(userId)`, and call it from all four. | ||
| - [ ] Muted teams (#784 preferences) don't create inbox rows, so they're already excluded. Verify with one mute test. |
|
|
||
| **Files:** new `src/features/huddle/CatchUp.tsx` (+ `CatchUp.test.tsx`), `src/pages/Huddle.tsx` (button), `meteor-backend/server/notifications.js` (methods). | ||
|
|
||
| - [ ] Method **`notifications.catchUp({ teamId, sort })`** returns topics with unread items for that team. For each: id, label, kind, unread count, mention count, newest time, and up to 3 unread posts (mentions first). Sort is `mentions` (topics with mentions first, then newest) or `recent`. Expose it. |
This branch has not been deployed
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.

What
Adds
docs/notification-topics-914-plan.md, an implementation plan for #914 written for a junior developer. Docs only, no code changes.The plan in short
Every notification is delivered into a Huddle conversation topic. The server finds the topic by
teamId + topicKey(for exampleticket:<id>,requests:<userId>,reminders:<userId>) or creates it, so a second event for the same ticket never makes a second topic. On top of that, the plan adds:Decisions already made:
Milestones (one PR each)
findOrCreateTopicwith a uniqueteamId + topicKeyindex (backend only).Open questions (marked⚠️ in the plan, to settle before Milestone 4)
team-join-request-approved/-declinedgo only to the Notifications page, since the requester isn't on the team.Prototype
https://claude.ai/artifact/Edq28kMx7c9YFEbR3CtruG (it must be shared before reviewers can open it)
Refs #914
🤖 Generated with Claude Code