Repository navigation
feat: support quiet hours for push notifications (REACT-1375) - #2000
Open
NikolaGoranNaumovski wants to merge 2 commits into
Open
NikolaGoranNaumovski wants to merge 2 commits into
NikolaGoranNaumovski wants to merge 2 commits into
Conversation
Add the schedule and remove_schedule push preferences, isInQuietHours, getDeviceTimeZone and QuietHoursDay, and keep client.user.push_preferences in sync after setPushPreferences.
NikolaGoranNaumovski
requested review from
MartinCupela,
isekovanic,
oliverlaz and
szuperaz
as code owners
November 6, 2026 10:13
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CLA
Description of the changes, What, Why and How?
Ticket: https://linear.app/stream/issue/REACT-1375
Spec: CHA-2667 Quiet hours – client SDK
v10 counterpart: #1999
The backend already supports quiet hours for push notifications. A user-level push preference can carry a
schedule(a timezone and 1–7 quiet windows), andremove_scheduleclears it. v9 has no types for them, so this PR adds the types, the helpers a UI needs, and keeps the connected user's preferences up to date after a save. The helpers and the merge are the same as in the v10 PR.Types (
src/types.ts)PushPreference:schedule?: PushScheduleInput,remove_schedule?: boolean.PushPreferencesResponse:schedule?: PushScheduleResponse.PushScheduleInput,PushScheduleResponse,QuietHoursRuleInputandQuietHoursRuleResponse. They follow the OpenAPI models (start/endasHH:MM, optionaldays).Helpers (
src/pushPreferences/, exported from the root)isInQuietHours({ schedule, date? })tells whether a schedule is quiet atdate(default: now).Intl.DateTimeFormat, so it follows daylight saving time.daysis checked against the previous day after midnight.daysapplies every day.00:00–24:00covers the whole day.getDeviceTimeZone()returns the device's IANA timezone, to pre-fill a schedule.QuietHoursDaynames the day values (mon…sun).Connected user
After a successful request,
setPushPreferencesmerges the user-level preferences of the connected user intoclient.user.push_preferences:user_preferences[userId]when the response has it.remove_scheduledrops the stored schedule unless the response returns a new one.remove_disabledoes the same fordisabled_until.client.userunchanged.client.useris replaced, not mutated, and only when the preferences changed.The second commit removes a
node_moduleslink that the first commit included by mistake.Tests
test/unit/pushPreferences/utils.test.tscoversisInQuietHours: windows, past midnight, the whole day, several rules, timezones and DST. It also coversgetDeviceTimeZoneand the merge cases.test/unit/pushPreferences/setPushPreferences.test.tscovers the request payload and the connected user's state.Changelog
schedule/remove_schedulepush preference types.isInQuietHours,getDeviceTimeZoneandQuietHoursDay.client.user.push_preferencesin sync aftersetPushPreferences.🤖 Generated with Claude Code