Mobile mention push: missing job context and wrong navigation; align payload and deep link with inspection

Objective

  • Make inspector mobile push mentions usable for client care: the recipient can tell which job the note refers to without opening the app blindly.
  • Make tap-to-open land on the correct inspection notes (including past jobs) whenever the underlying data supports it, instead of leaving the user on whatever screen they had open.
  • Preserve or improve sender context in the push title when the author is not stored as an inspector record.

Background

  • SE feedback: pushes feel like “generic mentions”; address / job identity is missing unless it happens to appear in the first part of the note body.
  • Deep linking today depends on inspectionId being present in the push data payload; if it is missing, the app does not navigate to the mentioned job—behavior that matches “opens the last work order I had open.”
  • @inspectors expands to whoever is assigned on the inspection at note-save time only; reassignment later does not create new mention notifications (separate product expectation some users may assume).
  • @office group rows use _membershipId: null and are skipped by the current push stream handler—out of scope for this story unless product explicitly expands scope.
  • Mention notifications are only created on note create (POST /note); PATCH updates do not call createMentionNotifications, so edits that add mentions do not re-run that path today.

Scope

Backend — note create and mention fan-out

  • New notes and mention handling live in attik-backend/src/routes/notes.ts: after Note save, createMentionNotifications in attik-backend/src/util/notifications/notificationService.ts runs for mentions on the body. Individual @ users and @inspectors both call createNotification, which persists metadata including inspectionId from note._relatedInspectionIds?.[0], noteId, quoteId, senderId, and mentionType.
  • @inspectors resolves recipients via getInspectorMemberships, which reads Inspection and active inspector Membership rows—snapshot at create time only.
  • The PATCH /:id handler in the same notes.ts file updates fields and saves but does not invoke createMentionNotifications.
  • Web and other clients that create notes must supply _relatedInspectionIds consistently when the note belongs to a job; activity-feed patterns appear in e.g. attik-frontend/src/components/activityFeed/NotesInput.tsx and ActivityFeed.tsx (related job ids passed when posting).

Backend — push payload

  • Notification inserts are watched in attik-backend/src/models/notificationSchema.ts, which forwards inserts to handleNotificationStream in attik-backend/src/events/streamHandlers/notificationStream.ts.
  • That handler builds title via buildPushTitle (sender name from Inspector.findById(metadata.senderId)), body via stripMentions on the stored message, assembles data (type, notificationId, noteId, target, optional inspectionId, senderId), and enqueues via queuePush from attik-backend/src/events/bullmq/pushWorker.ts into dispatchPush in attik-backend/src/util/functions/push/pushDispatchService.ts.
  • Push worker uses a rate limiter (10 jobs per second); large @inspectors fan-out can stagger delivery slightly but is orthogonal to missing inspectionId.

Mobile — tap handling

  • MentionPushData and getMentionNavigationPath in attik-mobile/hooks/usePushNotifications.ts require type === "mention" and a truthy inspectionId to return /inspection/{id}/notes.
  • PushNotificationTapHandler in attik-mobile/app/_layout.tsx listens for notification opens (foreground and cold start) and router.pushes when a path is returned; otherwise it does nothing for navigation.
  • Token registration uses POST push/register in attik-backend/src/routes/push.ts (same queue path conceptually).

Decision needed

  • Exact UX for job context on the banner (title vs subtitle vs richer copy) and whether to support fallback routes (e.g. noteId-only) when inspectionId is absent—product and eng should align before implementation.

References

  • Expo / device push behavior as configured in attik-mobile/hooks/usePushNotifications.ts and tap routing in attik-mobile/app/_layout.tsx.
  • Mention notification metadata shape in attik-backend/src/models/notificationSchema.ts (metadata.inspectionId, noteId, etc.).
  • Entry: attik-backend/src/util/notifications/notificationService.ts (createMentionNotifications, createNotification).
  • Entry: attik-backend/src/events/streamHandlers/notificationStream.ts (handleNotificationStream).

Please authenticate to join the conversation.

Upvoters
Status

Planned

Board
🏠

Main App

Date

24 days ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.