|
| 1 | +--- |
| 2 | +'@objectstack/service-messaging': patch |
| 3 | +'@objectstack/plugin-security': patch |
| 4 | +'@objectstack/platform-objects': patch |
| 5 | +'@object-ui/app-shell': patch |
| 6 | +'@object-ui/i18n': patch |
| 7 | +--- |
| 8 | + |
| 9 | +feat(account): a Notification Settings page where each person chooses their own notification topics, channels, digest and quiet hours |
| 10 | + |
| 11 | +Clause-②: yes |
| 12 | +Metadata-protocol: none |
| 13 | + |
| 14 | +The Account app has a new **Notification Settings** page, under Inbox and only when the messaging service runs. It shows one row per notification topic and one column per channel. Each cell shows whether that notification reaches you on that channel, and where the answer comes from: your own setting, your organization's default, the built-in default, or a mandatory topic. Mandatory topics are always delivered and cannot be switched off. A channel the deployment cannot send on yet says so in its column header. Above the matrix you can set your digest and your quiet hours. |
| 15 | + |
| 16 | +- **The read: `GET /api/v1/messaging/me/preferences`.** This new door answers the signed-in person's *effective* preferences. The server computes them with the same resolver `emit` uses to filter (`PreferenceResolver.effectiveFor`), so the page shows what is actually sent and computes nothing itself. The door takes no parameters and answers only about the caller: there is no `user` parameter, and any parameter is refused `VALIDATION_ERROR` / `400`. It keeps the posture of `GET /api/v1/messaging/preference-options`: |
| 17 | + - an anonymous caller gets `401`; |
| 18 | + - a held sign-in gets `403`; |
| 19 | + - a source it cannot read is `500` / `INTERNAL_ERROR`, never a partial or "everything on" answer. |
| 20 | + |
| 21 | + The door reads only what the answer needs: the caller's own rows and the organization's default rows, each by equality on `user_id` within the caller's organization. A read that comes back with more rows than its cap is a fault (`500`), never a page. |
| 22 | + |
| 23 | + The organization's defaults appear only as `source: 'default'` on the caller's own cells. No other person's row, and no row id except the caller's own, is ever answered. |
| 24 | +- **The writes: your own `sys_notification_preference` rows, through the data door, as you.** `member_default`, the baseline set every signed-in person resolves (external members excepted), now carries a grant of read, create and edit on the object, with no delete. Two row policies come with it: |
| 25 | + - `sys_notification_preference_self` binds every principal that holds the grant. Its row scope is `user_id == current_user.id`, and its write check is the same expression, so the row as written must still be your own. |
| 26 | + - `sys_notification_preference_org_admin` widens organization owners and administrators back to every row of their organization. Its write check is `topic != null`, which holds on every row being created because `topic` is required with a default. If `topic` ever becomes optional, an administrator's create is refused, never widened. |
| 27 | + |
| 28 | + An ordinary member or a delegated administrator lists only their own rows. Their create with `user_id` omitted, empty or naming another person is refused `403` / `PERMISSION_DENIED`, as is moving their own row to another person or to the organization default. |
| 29 | +- **Owners and administrators are unchanged.** They still list every row, create and edit the organization default, create and edit another person's row, and delete in the Setup grid. |
| 30 | +- **App-authored grants are narrowed too.** `sys_notification_preference_self` carries no `positions` domain, so it binds every principal that holds a grant on this object, including through an app's own permission set. A role other than organization owner or administrator that an app grants this object reads and writes only its own rows, unless the app declares its own widening policy for that role. |
| 31 | + |
| 32 | +There is no "reset to the organization's default" button, because that needs a delete, which members are not granted. Changing your digest or quiet hours saves your own general setting, and the page says so beside the control. From then on, that setting applies in place of the organization's defaults to every topic and channel you have not set yourself. |
0 commit comments