Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/31426-quiet-hours-widget-hint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@objectstack/service-messaging': patch
---

feat(service-messaging): the notification preference's `quiet_hours` declares the `quiet-hours` widget

Clause-②: no
Metadata-protocol: none

`sys_notification_preference.quiet_hours` now carries `widget: 'quiet-hours'`, so the console draws its quiet-hours control (a time-zone picker and two times) instead of the JSON editor, as `topic` and `channel` already name their pick-or-type inputs. The field stays `json` with the same stored shape, `{ tz?, start: 'HH:MM', end: 'HH:MM' }`, and nothing new is refused. `field-types.mdx` documents the three notification preference widgets.
14 changes: 14 additions & 0 deletions content/docs/data-modeling/field-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,20 @@ has none, the list is empty, or the load fails, the field is a text box that
takes the typed name; a failure is shown with its cause, and the box stays
editable.

### Notification preference inputs (`notification-topic`, `notification-channel`, `quiet-hours`)

The platform's notification preference (`sys_notification_preference`) declares three
widgets, so the record form offers choices instead of a bare box:

| Widget | Field | Draws | Stores |
|---|---|---|---|
| `notification-topic` | `topic` (`text`; also on `sys_notification_template`) | a pick-or-type list from `GET /api/v1/messaging/preference-options` | the topic as written, `*` for all |
| `notification-channel` | `channel` (`text`) | the same list, marking a known channel whose service is not configured | the channel id as written, `*` for all |
| `quiet-hours` | `quiet_hours` (`json`) | a time-zone picker and two times | `{ tz?, start: 'HH:MM', end: 'HH:MM' }` |

A typed topic or channel the list does not hold is still stored. Like every `widget` value,
a name no host registers falls back to the type's default input.

### A widget's face on the record heading

A `text` field that declares `widget: 'recipient-picker'` or `widget: 'object-ref'` is drawn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,9 @@ describe('sys_notification_preference topic / channel help (#25346)', () => {
expect(templateFields.channel?.widget).toBeUndefined();
expect(templateFields.channel?.type).toBe('text');
});

it('quiet_hours declares the quiet-hours widget and stays a json field (#31426)', () => {
expect(fields.quiet_hours?.widget).toBe('quiet-hours');
expect(fields.quiet_hours?.type).toBe('json');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ export const NotificationPreference = ObjectSchema.create({
quiet_hours: Field.json({
label: 'Quiet Hours',
required: false,
// [#30208 row 6, #31426] The widget hint names the console's
// quiet-hours control (#31421): a time-zone picker and two times
// over the same stored `{ tz?, start: 'HH:MM', end: 'HH:MM' }`.
// The field stays `json`, nothing new is refused, and an
// unregistered widget degrades to the JSON editor.
// `notification-preference-topic-channel-help.test.ts` pins it.
widget: 'quiet-hours',
description:
'A daily window when notifications are held and delivered when it ends, for example ' +
'{ "tz": "Europe/Berlin", "start": "22:00", "end": "07:00" }. Times are HH:MM in that time zone (UTC when tz is left out), ' +
Expand Down
Loading