Repository navigation
Commit fd471d3
fix(messaging): a member's own "no digest" or "no quiet hours" beats the organization's default (#36326)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X8UqWLrzTYpuat8L5eLdf2c)_
Fixes #35123
Clause-②: no
Metadata-protocol: none
Ruling: 7073270426 on #35123 (maintainer, verbatim: 「B 没设的项继续跟随组织」),
building ruling 6996036362 (「成员自己的选择优先」); interim hook per the seat's
answer to fork 7073430021, F1 carried by #36245.
## 维护者速读
-
用户能看到什么变化:成员在“通知设置”页选「不汇总」或清空免打扰时段并保存,从此真的不再收到组织默认的汇总或免打扰;没动过的那一项继续跟随组织,升级当天没有任何人的通知发生变化。
- 为什么做:落实「成员自己的选择优先」,解决成员退不出组织默认汇总和免打扰的问题(本卡已升为 p1)。
- 出错会怎样:最坏情况是某位成员的汇总或免打扰仍跟随组织,或一条旧数据被误当成本人选择;都只影响通知的送达时间,不丢通知,可通过撤回本 PR
恢复原行为。
- 要你做什么:请你审阅、批准并亲手合并。L1 ACCEPT 7076146202,契约 PASS 7076382062(座位 7,head
621aa11);一个不阻塞的问题(一次性转换只应改转换开始前的那批「不汇总」行)和两个可选项另立 #36369 跟进。
## What changes
Ruling 7073270426 (report letter B): a notification preference's
`digest` and `quiet_hours` are each **three states in storage**, and one
rule decides them. The most specific preference that sets a field
decides it. A preference that leaves a field empty decides nothing for
that field, so the walk goes on: the person's topic row, then their own
wildcard row, then the organization's default, then the built-in
default.
| State | `digest` | `quiet_hours` |
|---|---|---|
| not set (follows the next row) | empty | empty |
| explicitly off (decides: off) | `none` | `{ "off": true }` |
| a value (decides) | `daily` / `weekly` | a window `{ tz?, start, end
}` |
- **Object definition** (`notification-preference.object.ts`): `digest`
loses `defaultValue: 'none'`, so a row nobody chose a digest for stores
empty, and a stored `none` is the explicit "send each one right away"
its description already promised. Both field helps now state the three
states, in all 11 locales.
- **Resolver** (`preference-resolver.ts`): `parseDigest` admits `none`
as a decision. `parseQuietHours` reads `{ off: true }` as the explicit
off, and `off: true` wins over any other key. `resolveDigest` and
`resolveQuietHours` stop at the first row that sets the field (`!==
undefined`) rather than at the first truthy value. The door
(`effectiveFor`) answers a member's explicit off as `{ value: 'none' /
null, source: 'own' }`.
- **One-time conversion** (`preference-digest-conversion.ts`, wired at
`kernel:ready`): every stored `digest = 'none'`, in every organization,
becomes empty, ONCE. Before this release a stored `none` never took
effect, so no one's effective digest changes at upgrade. **Run-once
route:** a `sys_migration` ledger row
(`messaging-preference-digest-none-unset`), read and written through the
engine, with `DATA_MIGRATION_FLAG_OBJECT` imported from
`@objectstack/spec/system` and the id spelled locally. `plugin-auth`'s
`membership-backfill-ledger.ts` is the precedent. The row is CLAIMED
before the first rewrite, so no later boot runs again, whatever fails
mid-pass. Each rewrite is a compare-and-set (`where: { id, digest:
'none' }, multi: true`), so a value written since the read is left
alone. With no ledger on the kernel, or a ledger it cannot read, the
pass does not run and says so at `warn`. Per-row failures are named at
`error` with the fix. ⛔ It is deliberately NOT the every-boot shape of
`preference-user-conversion.ts`: after this release a `none` is a real
choice, and an every-boot pass would erase it.
- **The Notification Settings page** (`myPreferences.ts`,
`NotificationSettingsPage.tsx`): "No digest" (不汇总) is always offered and
saves `none`. Clearing the quiet-hours window and pressing Save stores
`{ off: true }`, never empty. A half-filled window still cannot be
saved. The `digestNoOff` and `quietHoursNoClear` notes are removed from
all 11 locale bundles. The quiet-hours control (`ui/packages/fields`) is
untouched: the page never hands it the marker, because the door answers
an explicit off as `null` with `source: 'own'`.
- **Docs**: `content/docs/data-modeling/field-types.mdx` states the
three states and the rule once.
### Why `{ "off": true }` for "no quiet hours, by choice" (for the
contract review)
- **A marked value, not `{}`.** `{}` and `null` are what a cleared
widget or an API caller writes for each other. One written for the other
would silently turn "off" back into "follow the organization". Nothing
produces `{ off: true }` by clearing something.
- **It stays an object**, so the column's one JSON shape family holds
and the existing JSON-string read path (`parseQuietHours` parses
strings) covers it unchanged.
- **It is inert to the field control.** `ui/packages/fields`
`readQuietHours` already reads any unknown key as `unreadable`: it shows
the value as stored and never rewrites it unless the person replaces it.
So the Setup grid cannot silently drop it.
- **It names its meaning.** `off: true` reads as "off" in a raw row, an
export or an audit diff, where `{}` reads as "nothing".
- **Precedence is declared**: `off: true` wins over any `start` / `end`
beside it. Mixing them is not a supported write, but if it happens it
reads as the stronger statement.
### Deviations
- **Interim owner-side hook, TEMPORARY, carried by #36245**
(`preference-digest-unset.ts`, bound in `messaging-service-plugin.ts`).
A SQL database created by an earlier release keeps the old physical
column default (`digest varchar(255) default 'none'`), and schema sync
never retrofits a column default on an existing table. On such a
database, an insert that omits `digest` would get `none` from the
database, which now means the member's explicit "no digest". The hook
writes `digest: null` on every insert that leaves it unset, so the
database default never fires. It comes out in the change that lands
#36245, and the code comment says so.
- 1 parent 7acc09b commit fd471d3
36 files changed
Lines changed: 942 additions & 130 deletions
File tree
- .changeset
- content/docs/data-modeling
- docs/audits/2026-08-tenant-audit-write-call-sites.counts/services
- packages/services/service-messaging/src
- objects
- translations
- ui/packages
- app-shell/src/console/notification-settings
- i18n/src/locales
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
1172 | | - | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
1173 | 1180 | | |
1174 | 1181 | | |
1175 | 1182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
255 | 261 | | |
256 | 262 | | |
257 | 263 | | |
| 264 | + | |
| 265 | + | |
258 | 266 | | |
259 | 267 | | |
260 | 268 | | |
| |||
471 | 479 | | |
472 | 480 | | |
473 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
474 | 499 | | |
475 | 500 | | |
476 | 501 | | |
| |||
540 | 565 | | |
541 | 566 | | |
542 | 567 | | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
543 | 579 | | |
544 | 580 | | |
545 | 581 | | |
| |||
949 | 985 | | |
950 | 986 | | |
951 | 987 | | |
| 988 | + | |
| 989 | + | |
952 | 990 | | |
953 | 991 | | |
954 | 992 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
192 | 200 | | |
193 | 201 | | |
194 | 202 | | |
195 | | - | |
196 | 203 | | |
197 | 204 | | |
198 | 205 | | |
199 | | - | |
| 206 | + | |
| 207 | + | |
200 | 208 | | |
201 | 209 | | |
202 | 210 | | |
| |||
209 | 217 | | |
210 | 218 | | |
211 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
212 | 223 | | |
213 | 224 | | |
214 | 225 | | |
215 | 226 | | |
216 | | - | |
| 227 | + | |
| 228 | + | |
217 | 229 | | |
218 | 230 | | |
219 | 231 | | |
| |||
0 commit comments