Repository navigation
Conversation
…page Add the settings backend for the customer tracking page refactor (PR 2): - TrackingPageConfig: the company config's shape, defaults and sanitizing (pages, branding, access, what verified visitors see), instance defaults for the generic page, slug rules with a reserved list, and accent contrast helpers (ink colour and WCAG ratio). - SettingController: get/save tracking-page-settings, a live slug check, and admin defaults. Saved slugs are indexed in fleet-ops.tracking-page-slugs.* so the public page resolves a company in one read; an enabled organization page refuses an invalid, reserved or taken slug. The read-back includes the slug status, the accent's ink and contrast, whether SMS is configured (Twilio counts only with credentials), and whether the customer portal is installed. - Routes under settings/, and a tracking-page-settings permission resource.
filter_var(null, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) returns false, not null, so every unset toggle (generic page allowed, powered by, the visibility defaults) came out false instead of its default.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #355 +/- ##
============================================
Coverage 100.00% 100.00%
- Complexity 12379 12452 +73
============================================
Files 600 601 +1
Lines 46496 46696 +200
============================================
+ Hits 46496 46696 +200
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
PR 2 of the customer tracking pages refactor. It adds the settings backend for a company's tracking page. The settings screen (PR 4) and the public pages (PRs 3 and 5) read this config.
What's stored
Company setting
tracking-page, always sanitized to a fixed shape byTrackingPageConfig::sanitize():org_pageenabled(off),slug(company name, slugified)generic_pageallowed(on)linkstarget:auto|org|generic(auto)brandingdisplay_name,logo_uuid,accent(#1F5FA8 or the instance default),accent_dark,support_phone,support_email,website,powered_by(on),theme(system|light),default_locale,locales(all 10)accesspublic_status(on),channels.sms/email(on),session_hours(24, range 1–168),account_sign_in(on),account_upsell(on)visibilitymap,driver_name,vehicle,items,pod_photo,pod_signature,report_problem(on);item_prices,instructions_edit(off);driver_contact(company)Instance-wide defaults for the generic page are stored in the system setting
fleet-ops.tracking-page(generic_page.enabledand branding fallbacks).Privacy rules are deliberately not settings: the map and driver hide after delivery, and the driver shows only while en route to the viewer's stops.
Endpoints (
fleet-ops/settings/…)GET/POST tracking-page-settings: the config, plus the read-back the screen needs:slug_validation;accent_inkandaccent_contrast;sms_available: Twilio counts only with credentials, becausegetAvailableProviders()always reports it;customer_portal_installed;POST tracking-page-settings/validate-slug: the live check while typing.GET/POST admin-tracking-page-settings: admin only.Permissions:
update tracking-page-settingsfor save and the slug check, andview tracking-page-settingsfor read. They come from a new resource in the FleetOps auth schema.Slugs
track,admin,api,customer-portal, …).fleet-ops.tracking-page-slugs.{slug}→ company uuid, so the public page resolves a company in one read rather than scanning every company's settings. Changing the slug frees the old index entry, but only if it still points at this company.Tests
TrackingPageSettingsTestcovers:The two seams that read the live environment (the SMS provider list and installed extensions) are marked
@codeCoverageIgnore; tests replace them.Depends on nothing. Plan: https://claude.ai/artifact/6Cd4e5QYiraFM3vjoakbyM