Files
pad/internal/models/notification_settings.go
T
xarmian 104f809e67 feat(store): enqueue push notifications at four store sites (TASK-3937 part B) (#2268)
* feat(store): enqueue push notifications at four store sites (TASK-3937 part B)

notifications.go writes queue rows on the caller's transaction, only for a
user with a registered device: item assignment (create and update),
comment and reply, fenced (app) comment, and reminder fire. The account
claim also deletes the old holder's devices, queue and settings.

Claude-Session: https://claude.ai/code/session_01JRXHP9ZVfEN3YEuzmucxP3

* fix(store): comment recipients collected without a closure so the appstore boundary walk resolves them (TASK-3937 part B)

Claude-Session: https://claude.ai/code/session_01JRXHP9ZVfEN3YEuzmucxP3

* docs(store): with the enqueue built, the Go comments say it exists (TASK-3937 part B)

A (07dc06285) future-tensed every sentence about the enqueue, because
part B had not merged. In part B's tree they read as false, so the
current description lives in Go comments:
- notifications.go's header: rows only for a user with a registered
  device, so nothing is written until TASK-3938; idempotent per
  (user, dedupe_key).
- migrated.go's push note.
- the settings model.
- nulExcluded's contract header.
Migration 155 is NOT edited: merged migrations are immutable, comments
included, so its owed-tense prose stays as history, and the
notifications.go header says which description is current.

Claude-Session: https://claude.ai/code/session_01JRXHP9ZVfEN3YEuzmucxP3

* docs(store): the enqueue says recipients are gated at send, and mentions are TASK-3946's (TASK-3937 part B r1)

Ruled on part B r1. notifications.go's header now says recipients are
not access-checked at enqueue: a removed member stays created_by and
possibly assignee, and the dispatcher (TASK-3939) is to re-check
membership and visibility at send. It also says the 'mention' kind is
enqueued by TASK-3946, from comment_mentions, not here.

Claude-Session: https://claude.ai/code/session_01JRXHP9ZVfEN3YEuzmucxP3
2026-10-21 03:31:18 -04:00

28 lines
970 B
Go

package models
// NotificationSettings are a person's recipient-side push filters (TASK-3937).
// The dispatcher (TASK-3939) is to apply them; the enqueue does not, so
// changing one never rewrites the queue.
type NotificationSettings struct {
PushEnabled bool `json:"push_enabled"`
NotifyAssigned bool `json:"notify_assigned"`
NotifyComments bool `json:"notify_comments"`
NotifyReplies bool `json:"notify_replies"`
NotifyReminders bool `json:"notify_reminders"`
NotifyMentions bool `json:"notify_mentions"`
IncludeAgentActivity bool `json:"include_agent_activity"`
}
// DefaultNotificationSettings is what a user with no settings row has: every
// kind on, agent activity off.
func DefaultNotificationSettings() NotificationSettings {
return NotificationSettings{
PushEnabled: true,
NotifyAssigned: true,
NotifyComments: true,
NotifyReplies: true,
NotifyReminders: true,
NotifyMentions: true,
}
}