Repository navigation
feat: switch notification types off per car - #774
Open
arthur-lzrs wants to merge 1 commit into
Open
arthur-lzrs wants to merge 1 commit into
arthur-lzrs wants to merge 1 commit into
Conversation
A device could only switch a notification type off for every car at once, so on an account
with two cars there was no way to mute, say, "door left open" for one car and keep it for the
other.
With two or more cars, a Car picker above the type checklist now chooses whether the list is
for all cars or for one. A type switched off for one car stays on for the others, and a type
switched off for all cars stays off for every car; a car's own list shows that row locked. The
list for all cars offers every type any car can produce, a car's own list the types that car
can. The choice is kept per device, like the rest of the checklist, and the bell and the
browser notifications follow it too. A notification that names no car (the MG sign-in failing)
answers to the list for all cars alone, so a car's list does not offer it.
Backend: PushSubscription gets ExcludedCategoriesByVehicle, a jsonb column keyed by vehicle id
(one additive migration, default {}). POST /api/push/subscribe takes the new optional
excludedCategoriesByVehicle; left out, it keeps what is stored, so a page that predates it
changes nothing. The values go through VehicleCategoryExclusions.Normalize (known types only,
once each, in one order, at most 32 cars), so an unchanged choice compares equal and a
registration that changes nothing writes nothing. NotificationCategories.IsWanted takes the
car's list as a fourth argument, and PushSenderService passes the one for the notification's
vehicle.
Frontend: notificationTypeExclusionsByVehicle in the UI settings, local to the device like the
other two lists, sent with every push registration. isCategoryShown and vehicleExclusionsOf
carry the same rule as the server.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Summary
A device can switch a notification type off, but only for every car at once. On an account with two cars there is no way to mute, say, "door left open" for one car and keep it for the other.
With two or more cars, a Car picker above the type checklist (Settings > Notifications) now chooses whether the list is for all cars or for one:
How it works
PushSubscription.ExcludedCategoriesByVehicle, ajsonbcolumn keyed by vehicle id. One additive migration, default{}, so rows from before want everything for every car.POST /api/push/subscribetakes an optionalexcludedCategoriesByVehicle; left out, it keeps what is stored, so an older page changes nothing.VehicleCategoryExclusions.Normalizekeeps known types only, once each, in one order, for at most 32 cars, so an unchanged choice compares equal and a registration that changes nothing writes nothing.NotificationCategories.IsWantedtakes the car's list as a fourth, optional argument, andPushSenderServicepasses the one for the notification's vehicle.notificationTypeExclusionsByVehiclein the UI settings (local to the device, like the other two lists), sent with every push registration.isCategoryShownandvehicleExclusionsOfcarry the same rule as the server.Type of Change
Related Issues
None.
How it was tested
jsonbcolumn (round trip, the same choice in another order writes nothing, a row without the column's value reads as no exclusions).DEMO_SECOND_VEHICLE=true, in the browser, down to 320 px wide.Notes for review
nl,esandpt-PTare my own drafts, so a native check is welcome.pt(Brazilian) is checked by a native speaker.UserSettingsRepositoryPostgresTests.SavesAtTheSameMoment_KeepEveryDevicesKeys(eight concurrent saves) failed once for me when the whole suite ran under load, and passed six times in a row on its own.Checklist
pnpm checkinfrontend/, anddotnet test --project src/GarageStack.Testsplusdotnet format GarageStack.slnx --verify-no-changesat the rootfeat: ...,fix(frontend): ...)ITripRepository): done in the demo too, with a step inTripRepositoryContractTests(not applicable)documentation/openapi.jsonis committedsrc/GarageStack.Data/Demo/(no new data needed: the demo already has notifications for both cars, and the picker shows withDEMO_SECOND_VEHICLE=true)frontend/src/locales/unraid/garagestack.xmlchanged: synced tojoszz/unraid-community-appsafter merge (not applicable, it did not change)