Commit Graph

9536 Commits

Author SHA1 Message Date
Jay Ohms 74eac289ee Improve the structure so users_with_active_accounts is available on identity 2026-02-27 09:17:12 -05:00
Jay Ohms 42900cf170 Only return identity accounts that are active with an active user 2026-02-26 16:45:16 -05:00
Jay Ohms e7241204eb Merge pull request #2615 from basecamp/card-perma-editing
Mobile: card perma improvements
2026-02-26 08:15:18 -05:00
Jay Ohms 867267890b Update app/javascript/controllers/bridge/buttons_controller.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-26 08:05:48 -05:00
Jay Ohms 7427675fc8 PR feedback 2026-02-26 07:53:02 -05:00
Jay Ohms 84c650ab25 Fix beforeunload event listeners 2026-02-26 07:41:51 -05:00
Jay Ohms 2d41463074 Merge branch 'main' into card-perma-editing
* main: (56 commits)
  Update app/views/cards/container/_closure_buttons.html.erb
  Update app/views/columns/show/_add_card_button.html.erb
  Update app/views/events/index/_add_card_button.html.erb
  Just return the object
  Rename is-main-action to display-as-primary-action
  Remove debug line
  Rename show-label to display-title
  Include path in web push payload for backwards compatibility
  Add base_url to native push notification payload
  Use internal account ID as `account_id` and add `account_slug`
  Make APNS and FCM env vars available
  Fix devices_path route helper in native devices partial
  Fix tests for renamed fixtures and new stacked notifications
  Add creator_familiar_name to push notification payload
  Add creator initials and avatar color to push notification payload
  Add avatar_url so we always get an avatar even when the user hasn't set one
  Document --push flag for testing native push notifications
  Don't read APNS_TEAM_ID from 1Password
  Simplify push.yml to only use B64 encryption keys
  Rename apns-dev to push-dev and unify 1Password credentials
  ...
2026-02-26 07:32:18 -05:00
Adrien Maston 1505ed7783 Merge pull request #2611 from basecamp/mobile/tweak-bridge-buttons 2026-02-26 13:23:39 +01:00
Adrien Maston c4cea3d5db Update app/views/cards/container/_closure_buttons.html.erb
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-26 12:14:37 +01:00
Adrien Maston 7f6351ea41 Update app/views/columns/show/_add_card_button.html.erb
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-26 12:14:28 +01:00
Adrien Maston 3f7b33889b Update app/views/events/index/_add_card_button.html.erb
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-26 12:14:13 +01:00
Adrien Maston a62defb570 Just return the object 2026-02-26 11:48:01 +01:00
Adrien Maston 047e8efad3 Rename is-main-action to display-as-primary-action 2026-02-26 11:33:24 +01:00
Adrien Maston fc1ee616c8 Remove debug line 2026-02-26 11:13:39 +01:00
Adrien Maston 158e95de42 Rename show-label to display-title 2026-02-26 11:12:01 +01:00
Jay Ohms 339a37576c Try adding turbo:before-visit event listener to test refreshing on iOS 2026-02-26 05:04:14 -05:00
Jay Ohms 2095848d32 Remove the ability to add/remove background images for now in the apps, since it's buggy 2026-02-25 15:40:37 -05:00
Jay Ohms 6ceb5ef7c3 Notify the form/buttons components of a disconnect before a page reload. This gives the native components an opportunity to reset their state before the fresh page loads. 2026-02-25 15:32:00 -05:00
Jay Ohms 91aa806b72 Don't show the bridged button to the board when editing a card 2026-02-25 14:40:31 -05:00
Rosa Gutierrez fc0e477141 Include path in web push payload for backwards compatibility
Old service workers cached in browsers still read `data.path` from the
push notification payload. Include it alongside `data.url` so notification
clicks keep working until those service workers update.

Currently we only register the service worker in the notification
settings screen, so this won't happen very often. Once we introduce
offline mode, we'll register the service worker in more places, so we
should be able to remove this.
2026-02-25 20:17:16 +01:00
Rosa Gutierrez 5b689dfac7 Merge pull request #2511 from basecamp/native-push-notifications
Support native push notifications
2026-02-25 19:55:04 +01:00
Rosa Gutierrez 13268ef668 Add base_url to native push notification payload
Include the server's base URL so native apps can identify which Fizzy
instance (SaaS or self-hosted) a notification originated from.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 6fb24118ea Use internal account ID as account_id and add account_slug
In native push payload, to be consistent about how we refer to
this in other endpoints.
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 5bea9633d0 Make APNS and FCM env vars available
To beta and production deploys.
2026-02-25 19:31:13 +01:00
Rosa Gutierrez abef50c503 Fix devices_path route helper in native devices partial
The manage devices link used `devices_path` but the route is defined in
the saas engine, so it needs `saas.devices_path`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 92cb749e16 Fix tests for renamed fixtures and new stacked notifications
Clear assignee's existing notifications in setup since Notifier now
uses create_or_find_by instead of create, and reload the association
to avoid caching after destroy_all.

Update fixture references after rebase: use `logo_assignment_kevin`
as base notification and `logo_mentioned_david` for mention tests.
Update source to `logo_published` in tests that need generic card events.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Fernando Olivares cefc20612a Add creator_familiar_name to push notification payload
Include the shortened familiar name format (e.g., "Salvador D.")
for display in iOS notification titles.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Fernando Olivares b1cdb72381 Add creator initials and avatar color to push notification payload
Move avatar_background_color logic from helper to User::Avatar concern
so it can be accessed from models. Include creator_id, creator_initials,
and creator_avatar_color in native push notifications for local avatar
rendering on iOS.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Fernando Olivares 113e61d418 Add avatar_url so we always get an avatar even when the user hasn't set one 2026-02-25 19:31:13 +01:00
Rosa Gutierrez 6ec3cc6f2c Document --push flag for testing native push notifications
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 9c165e1e89 Don't read APNS_TEAM_ID from 1Password
It's a public value like the APNs topic, so just fallback to this value
in push.yml. In this way we have one fewer field we need to maintain
consistently across multiple 1Password items.
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 5ad1e8cee7 Simplify push.yml to only use B64 encryption keys
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez d1500ad4ec Rename apns-dev to push-dev and unify 1Password credentials
- Rename script from apns-dev to push-dev (handles both APNs and FCM)
- Fetch credentials from Deploy/Fizzy Production (same as Kamal)
- Use _B64 env vars to avoid escaping issues with multiline keys
- Update bin/dev flag from --apns to --push

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez dbfb141b6f Restore PushNotificationJob as shim for in-flight jobs during deploy
In-flight jobs queued before deploy would fail if the old class is
missing. This shim delegates to the new notification.push method.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 126ccb5e3a Add integration test for notification delivery and simplify test helpers
- Add comprehensive integration test covering card assignment, comments,
  mentions, email bundling, and edge cases (system user, inactive user)
- Inline push notification test helpers into the only test that uses them
- Remove separate PushNotificationTestHelper module

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 1a0d8e2501 Fix notification click URL by using correct data property
The web push payload sends the URL in data.url but the service
worker was looking for data.path, resulting in undefined URLs.

Also fix WebPush::Notification test to use url instead of path

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 155fa2da97 Go back to RubyGems version of action_push_native
After releasing the new version: https://github.com/rails/action_push_native/releases/tag/v0.3.1
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 6b1598eebb Configure APNS and FCM encryption keys in Kamal secrets
Move encryption keys to base64 password fields for easier Kamal secret
management, and organize them at the root level.
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 7864748be9 Simplify PushTarget by removing template method pattern
Each target now implements process directly with its own logic,
rather than using processable?/perform_push hooks. The pushable?
check is done once in Notification#push before iterating targets.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 0948533da7 Rename push to process on PushTarget for clearer semantics
"Push to target" reads naturally - we push the notification to the
target. "Target processes" also makes sense - the target receives
and handles the notification in its own way.

- Add class method PushTarget.process(notification) that instantiates
  and calls the instance method
- Rename instance method from push to process
- Add private push_to helper in Pushable for readable iteration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 3621df8f0f Consolidate push jobs into single Notification::PushJob
Replace separate WebPushJob and NativePushJob with a single PushJob
that calls notification.push, which iterates over registered targets.
Each target handles its own delivery - Web pushes synchronously via
the pool, Native enqueues device-level jobs via deliver_later_to.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 4f19c42958 Move category and high_priority to payload classes
Use polymorphism instead of case statements in Native push target:
- DefaultPayload#category returns "default", #high_priority? returns false
- EventPayload#category returns "assignment"/"comment"/"card" based on action
- MentionPayload#category returns "mention", #high_priority? returns true

This simplifies the Native push target by delegating source-specific
logic to the appropriate payload classes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 9299300dbf Move push priority concerns from Event and Mention into Native push target 2026-02-25 19:31:13 +01:00
Rosa Gutierrez 34fd62faf1 Move devices table to saas database
Use ActionPushNative's new on_load hook to configure the database connection,
following the same pattern as Active Storage and Action Text:

  ActiveSupport.on_load(:action_push_native_record) do
    connects_to database: { writing: :saas, reading: :saas }
  end

This allows ApplicationPushDevice to inherit directly from ActionPushNative::Device
without needing an intermediate abstract class.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 1b53396050 Make devices controller untenanted with engine routes
- Add disallow_account_scope to skip tenant requirement
- Move routes to saas/config/routes.rb (engine routes)
- Use saas.devices_path/saas.device_path for engine route helpers
- Update tests to work without tenant context

Devices belong to Identity (global), not Account, so they don't
need tenant context in the URL.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Fernando Olivares c7d0559191 Change priority notification level for mentions and assignments 2026-02-25 19:31:13 +01:00
Rosa Gutierrez 2f9e41d356 Remove foreign key constraint from devices to sessions
Devices should persist independently of sessions - when a session is
deleted, the device registration should remain valid.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 8a77fd7966 Squash device migrations into single table creation
Consolidates the session reference and index cleanup into the original
CreateActionPushNativeDevices migration for a cleaner migration history.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez 92f283c4d9 Remove redundant owner index from devices table
The unique (owner_type, owner_id, token) index already serves queries
filtering by (owner_type, owner_id) via its leftmost prefix.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00
Rosa Gutierrez ab6bc256eb Link devices to sessions for automatic cleanup on logout
When a session is destroyed (user logs out), all devices registered
to that session are automatically destroyed, preventing push
notifications from being sent to logged-out devices.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00