Skip to content

Add Google OAuth sign and and user attributes#112

Merged
apdarr merged 14 commits intomainfrom
iss-111
Mar 2, 2026
Merged

Add Google OAuth sign and and user attributes#112
apdarr merged 14 commits intomainfrom
iss-111

Conversation

@apdarr
Copy link
Copy Markdown
Owner

@apdarr apdarr commented Feb 28, 2026

Closes #111

Copilot AI review requested due to automatic review settings February 28, 2026 16:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 users plus Active Record encryption configuration.
  • Refactor plan calendar week selection to a GET week parameter (removing the Stimulus week selector controller) and preserve week across 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.plan is 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 }

@apdarr apdarr merged commit 29be628 into main Mar 2, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Google social login and Google calendar syncing

2 participants