Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Google OAuth login alongside existing Strava OAuth, stores Google credential attributes on User, and begins adapting the UI/flows to support Google-only accounts (including Strava linking from Profile). It also refactors the plan “week selector” UI to be server-driven via a week query param and introduces Active Record encryption for stored OAuth tokens.
Changes:
- Add Google OAuth provider (routes + OmniAuth initializer), user persistence logic, and tests for sign-in/linking flows.
- Add encrypted Google token fields to
usersplus Active Record encryption configuration. - Refactor plan calendar week selection to a GET
weekparameter (removing the Stimulus week selector controller) and preserveweekacross activity create/edit flows.
Reviewed changes
Copilot reviewed 44 out of 45 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
test/test_helper.rb |
Filters Google credentials in VCR cassettes. |
test/system/sessions_test.rb |
Adds system test coverage for Google sign-in and updates flash assertions. |
test/system/plans_test.rb |
Updates selectors to match new server-driven week selector + link-based buttons. |
test/models/user_test.rb |
Adds tests for Google user creation/linking and Strava linking helpers. |
test/models/activity_test.rb |
Adds tests for Activity#matched_strava_activity. |
test/jobs/match_strava_activity_job_test.rb |
Removes tests for deleted Strava matching job. |
test/fixtures/users.yml |
Adds Google-only and linked users for new test scenarios. |
test/controllers/sessions_controller_test.rb |
Adds integration tests for Google callback, failures, and Strava linking behavior. |
test/controllers/profile_controller_test.rb |
Tests profile behavior differences for Google-only vs Strava-connected users. |
db/schema.rb |
Reflects new Google OAuth columns and index on users. |
db/migrate/20260210214202_add_google_oauth_to_users.rb |
Adds Google UID and token fields to users. |
config/routes.rb |
Adds Google auth endpoints and an OmniAuth failure endpoint. |
config/initializers/omniauth.rb |
Adds Google OAuth2 provider configuration and updates Strava scope. |
config/credentials/test.yml.enc |
Updates encrypted test credentials. |
config/credentials/production.yml.enc |
Updates encrypted production credentials. |
config/credentials/environment.yml.enc |
Updates encrypted environment credentials. |
config/credentials/development.yml.enc |
Updates encrypted development credentials. |
config/application.rb |
Enables reading unencrypted data during encryption rollout. |
app/views/sessions/new.html.erb |
Adds “Continue with Google” button on login page. |
app/views/profile/edit.html.erb |
Shows Strava webhook settings only when Strava is connected; adds “Connect Strava” CTA otherwise. |
app/views/plans/show.html.erb |
Replaces Stimulus-based week switching with GET week param and reworks Add/Edit links to preserve week. |
app/views/activities/show.html.erb |
Enhances layout; shows linked Strava activity details when present. |
app/views/activities/new.html.erb |
Updates layout and links back to plan with week. |
app/views/activities/edit.html.erb |
Updates layout and links back to plan with week. |
app/views/activities/_form.html.erb |
Preserves week via hidden field and adjusts cancel behavior. |
app/models/user.rb |
Adds encryption for OAuth tokens; implements Google sign-in/linking + Strava token refresh helpers. |
app/models/activity.rb |
Adds helper to fetch matched/linked StravaActivity. |
app/jobs/match_strava_activity_job.rb |
Removes old Strava matching job. |
app/jobs/fetch_and_match_strava_activity_job.rb |
Refactors to fetch Strava activity using refreshed tokens and attempts to match/link activities. |
app/javascript/controllers/week_selector_controller.js |
Removes the Stimulus controller previously used for week switching. |
app/controllers/sessions_controller.rb |
Adds OAuth failure action; supports Google provider and Strava linking flow. |
app/controllers/profile_controller.rb |
Prevents enabling Strava webhooks for users without a connected Strava account. |
app/controllers/plans_controller.rb |
Introduces @week parameter for plan show. |
app/controllers/activities_controller.rb |
Preserves week through new/edit/create/update flows and redirects. |
Gemfile |
Adds omniauth-google-oauth2. |
Gemfile.lock |
Locks omniauth-google-oauth2 dependency. |
.github/skills/views/SKILL.md |
Adds repository guidance for Rails views patterns. |
.github/skills/testing/SKILL.md |
Adds repository guidance for Minitest/VCR/system tests. |
.github/skills/security/SKILL.md |
Adds repository guidance for Rails security practices. |
.github/skills/models/SKILL.md |
Adds repository guidance for ActiveRecord/model patterns. |
.github/skills/jobs/SKILL.md |
Adds repository guidance for Rails 8 Solid Stack background jobs. |
.github/skills/hotwire/SKILL.md |
Adds repository guidance for Hotwire/Turbo/Stimulus usage. |
.github/skills/debugging/SKILL.md |
Adds repository guidance for debugging Rails issues. |
.github/skills/controllers/SKILL.md |
Adds repository guidance for controller conventions and strong params. |
Comments suppressed due to low confidence (1)
app/controllers/activities_controller.rb:61
- Same issue on update:
redirect_to plan_path(@activity.plan, week: @week)will raise when@activity.planis nil. Add a nil-safe fallback redirect or enforce presence of a plan for activities that use the plan calendar flow.
if @activity.update(activity_params)
format.html { redirect_to plan_path(@activity.plan, week: @week), notice: "Activity was successfully updated." }
format.json { render :show, status: :ok, location: @activity }
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…e activity matching logic
…e activity matching logic
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.
Closes #111