Commit 26c2e49
authored
fix(push-preferences): align chat push preference types with the API (#1786)
## CLA
- [ ] I have signed the [Stream
CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform)
(required).
- [ ] Code changes are tested
## Description of the changes, What, Why and How?
**What** — Re-models the chat push notification preference types so they
match the client-side API.
**Why** — Reported in GetStream/stream-chat-react-native#3341. The
shipped `PushPreference` was camelCase (`callLevel`, `chatLevel`,
`disabledUntil`, `removeDisable`) and missing `channel_cid` / `user_id`,
so channel-level and server-side preferences couldn't be set
type-safely. The canonical client-side OpenAPI spec
(`chat-openapi-clientside.yaml`) shows `/push_preferences` is entirely
**snake_case**, and `setPushPreferences` posts the body verbatim (no
camelCase→snake_case transform) — so the existing camelCase keys never
reached the server.
**How** — Aligned to `PushPreferenceInput` / `PushPreferencesResponse` /
`ChannelPushPreferencesResponse`, scoped to chat and calls (feeds out of
scope):
- `PushPreference` (input): `call_level`, `channel_cid`, `chat_level`,
`chat_preferences`, `disabled_until`, `remove_disable`, `user_id`.
- New `ChatPreferences` (granular per-mention prefs) and
`PushPreferencesResponse`.
- Widened `ChatLevelPushPreference` to `all | mentions | direct_mentions
| all_mentions | none | default`.
- Fixed `ChannelPushPreference`, `UpsertPushPreferencesResponse`, and
`push_preferences` on `ChannelAPIResponse` / `OwnUserBase`.
- `client.setPushPreferences(prefs: PushPreference[])` is unchanged — it
already wraps the array as `{ preferences }`.
1 parent c60134d commit 26c2e49
2 files changed
Lines changed: 57 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
383 | | - | |
| 383 | + | |
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
| |||
685 | 685 | | |
686 | 686 | | |
687 | 687 | | |
688 | | - | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
689 | 701 | | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
690 | 720 | | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
695 | 736 | | |
696 | 737 | | |
| 738 | + | |
697 | 739 | | |
698 | | - | |
699 | | - | |
700 | | - | |
| 740 | + | |
| 741 | + | |
701 | 742 | | |
702 | 743 | | |
703 | 744 | | |
704 | | - | |
705 | | - | |
706 | | - | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
707 | 749 | | |
708 | 750 | | |
709 | 751 | | |
| |||
862 | 904 | | |
863 | 905 | | |
864 | 906 | | |
865 | | - | |
| 907 | + | |
866 | 908 | | |
867 | 909 | | |
868 | 910 | | |
| |||
0 commit comments