Skip to content

Hotfix For sofia user accounts - #1144

Merged
lodewiges merged 2 commits into
stagingfrom
hotfix/sofia-accounts
Dec 4, 2025
Merged

Hotfix For sofia user accounts#1144
lodewiges merged 2 commits into
stagingfrom
hotfix/sofia-accounts

Conversation

@lodewiges

@lodewiges lodewiges commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

Checklist

  • Merged database migrations into 1 database migration.
  • Tested database migrations from origin/staging (git checkout staging ; git pull ; bundle exec rails db:reset ; git checkout BRANCH ; bundle exec rails db:migrate).

Summary

Shortly summarize the changes in this pull request. Does it concern changes in the UI, add some screenshots. Are there related issues solved? Please, mention them (with 'fixes #xyz', see https://github.com/blog/1506-closing-issues-via-pull-requests), so they can be resolved automatically when merging this pull request.

Other information

If there is some other relevant and important information for this pull request, mention it here. For example, related pull requests or newly introduced conventions, packages or other dependencies.

Summary by CodeRabbit

  • Refactor
    • Modernized icon rendering across user and account settings interfaces for consistent Font Awesome usage.
  • Bug Fix
    • Adjusted configuration check that controls visibility of the "amber" user section and login option so the feature shows based on the correct configuration value.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings December 4, 2025 16:50
@coderabbitai

coderabbitai Bot commented Dec 4, 2025

Copy link
Copy Markdown

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Updated view conditionals to check amber_api_host instead of amber_api_url, and replaced Rails Font Awesome helper calls with direct <i> tags for icon rendering in several user-facing views.

Changes

Cohort / File(s) Summary
Configuration condition updates
app/views/partials/_login_prompt.html.erb, app/views/users/index.html.erb
Changed conditional checks from Rails.application.config.x.amber_api_url.present? to Rails.application.config.x.amber_api_host.present?, affecting when amber-related UI blocks render.
Font Awesome icon rendering
app/views/users/_edit_sofia_account_modal.html.erb, app/views/users/show.html.erb
Replaced fa_icon helper calls with inline <i class="..."> Font Awesome tags for various icons (caret, sliders, Android/Apple/Windows), preserving CSS classes and surrounding markup.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Quick pattern replacements across a few view files.
  • Check that amber_api_host is defined where expected.
  • Verify Font Awesome class names match available icon set (e.g., fa-sliders-h).

Poem

🐰 A swap of host for url, a flick of an eye,
Icons donned their <i> coats and hopped right by,
Views tidy and small, like a neat little trail,
I nibble the changes and leave a soft tail. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is entirely composed of template placeholders with no actual content provided by the author. The Summary section lacks any description of changes, UI details, or related issues. Provide a meaningful summary of the changes, describe any UI modifications or icon updates, reference related issues with 'fixes #xyz' syntax, and fill in the Other information section as needed.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Hotfix For sofia user accounts' is specific and directly related to the primary changes: configuration updates for Sofia account UI rendering and Font Awesome icon replacements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hotfix/sofia-accounts

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 476829a and 5ca83b3.

📒 Files selected for processing (1)
  • app/views/users/_edit_sofia_account_modal.html.erb (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/views/users/_edit_sofia_account_modal.html.erb
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR appears to be a hotfix that makes two types of changes: replacing FontAwesome helper method calls with direct HTML, and changing configuration variable references from amber_api_url to amber_api_host. However, the configuration variable change introduces critical bugs.

  • Replaced fa_icon helper calls with direct <i> tags for FontAwesome icons
  • Changed configuration variable references from amber_api_url to amber_api_host (incorrectly)

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
app/views/users/show.html.erb Replaced fa_icon 'sliders' helper with direct HTML <i class="fas fa-sliders-h"> tag
app/views/users/index.html.erb Changed amber_api_url.present? to amber_api_host.present? (bug: incorrect variable)
app/views/users/_edit_sofia_account_modal.html.erb Replaced multiple fa_icon helpers with direct HTML tags and fixed indentation inconsistency
app/views/partials/_login_prompt.html.erb Changed amber_api_url.present? to amber_api_host.present? (bug: incorrect variable)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<div class="card mb-3">
<div class="card-header py-2" type="button" data-bs-toggle="collapse" data-bs-target="#user-data-collapse" aria-expanded="false" aria-controls="user-data-collapse">
<h5 class="mb-0 py-1">Gegevens <%= fa_icon 'caret-down', class: 'float-end me-1' %></h5>
<div class="card-header py-2" type="button" data-bs-toggle="collapse" data-bs-target="#user-data-collapse" aria-expanded="false" aria-controls="user-data-collapse">

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

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

Inconsistent indentation: This line has extra indentation (14 spaces instead of 12). It should align with the sibling <h5> tag on line 13.

Suggested change
<div class="card-header py-2" type="button" data-bs-toggle="collapse" data-bs-target="#user-data-collapse" aria-expanded="false" aria-controls="user-data-collapse">
<div class="card-header py-2" type="button" data-bs-toggle="collapse" data-bs-target="#user-data-collapse" aria-expanded="false" aria-controls="user-data-collapse">

Copilot uses AI. Check for mistakes.
<users-table :users="manual_users" class="mb-5"></users-table>

<% if Rails.application.config.x.amber_api_url.present? %>
<% if Rails.application.config.x.amber_api_host.present? %>

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

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

This change from amber_api_url to amber_api_host is inconsistent with other parts of the codebase. According to config/application.rb, both variables exist:

  • amber_api_host contains just the hostname (e.g., "example.com")
  • amber_api_url contains the full URL with protocol (e.g., "https://example.com")

The .present? check should remain as amber_api_url.present? to be consistent with other files that use amber_api_url for actual API calls (see app/controllers/users_controller.rb lines 127 and 169, app/models/user.rb line 56, and app/views/users/show.html.erb line 63).

Suggested change
<% if Rails.application.config.x.amber_api_host.present? %>
<% if Rails.application.config.x.amber_api_url.present? %>

Copilot uses AI. Check for mistakes.
</div>
<ul class="list-group list-group-flush">
<% if Rails.application.config.x.amber_api_url.present? %>
<% if Rails.application.config.x.amber_api_host.present? %>

Copilot AI Dec 4, 2025

Copy link

Choose a reason for hiding this comment

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

This change from amber_api_url to amber_api_host is inconsistent with other parts of the codebase. According to config/application.rb, both variables exist:

  • amber_api_host contains just the hostname (e.g., "example.com")
  • amber_api_url contains the full URL with protocol (e.g., "https://example.com")

The .present? check should remain as amber_api_url.present? to be consistent with other files that use amber_api_url for actual API calls (see app/controllers/users_controller.rb lines 127 and 169, app/models/user.rb line 56, and app/views/users/show.html.erb line 63).

Suggested change
<% if Rails.application.config.x.amber_api_host.present? %>
<% if Rails.application.config.x.amber_api_url.present? %>

Copilot uses AI. Check for mistakes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 514b044 and 476829a.

📒 Files selected for processing (4)
  • app/views/partials/_login_prompt.html.erb (1 hunks)
  • app/views/users/_edit_sofia_account_modal.html.erb (6 hunks)
  • app/views/users/index.html.erb (1 hunks)
  • app/views/users/show.html.erb (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Test
  • GitHub Check: Lint
  • GitHub Check: Agent
🔇 Additional comments (5)
app/views/users/index.html.erb (1)

27-27: Config key change consistent with other files.

This change aligns with the same configuration update in app/views/partials/_login_prompt.html.erb. Please ensure the verification script from that file confirms all references are properly updated.

app/views/users/show.html.erb (2)

63-63: Note: amber_api_url still used here for URL construction.

Line 63 still references amber_api_url to construct a full URL to the amber user profile. This appears intentional since it's building a URL, not checking presence. However, verify this is correct given the config key changes elsewhere (from amber_api_url to amber_api_host for presence checks).


74-74: Icon change from fa-sliders to fa-sliders-h is intentional and supported. Font Awesome 7.1.0 (installed via npm) fully supports fa-sliders-h as the horizontal sliders icon. The git commit "chang icons and amber api url check" confirms this was an intentional update. No compatibility concerns.

app/views/users/_edit_sofia_account_modal.html.erb (2)

89-89: Brand icon prefixes correctly updated.

The platform brand icons (Android, Apple, Windows) have been correctly updated to use the fab (Font Awesome Brands) prefix instead of the fa_icon helper. This is the correct approach for Font Awesome 5+ brand icons.

Also applies to: 98-98, 107-107


13-13: Icon rendering approach updated consistently.

All three lines (13, 41, 55) in the file use inline Font Awesome <i> tags with the fas prefix for caret-down icons. The codebase search confirms no remaining fa_icon helper usages exist in views or Ruby files, indicating the migration to inline tags is complete across the project.

</div>
<ul class="list-group list-group-flush">
<% if Rails.application.config.x.amber_api_url.present? %>
<% if Rails.application.config.x.amber_api_host.present? %>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check for amber_api configuration usage across the codebase

echo "=== Searching for amber_api_host references ==="
rg -n "amber_api_host" --type ruby

echo -e "\n=== Searching for amber_api_url references ==="
rg -n "amber_api_url" --type ruby

echo -e "\n=== Checking config files for amber_api definitions ==="
fd -e rb -e yml config | xargs rg -l "amber_api"

Repository: csvalpha/sofia

Length of output: 1140


Update configuration references to use amber_api_host consistently throughout the codebase.

The new code uses amber_api_host, but amber_api_url is still referenced in multiple files:

  • app/models/user.rb:56
  • app/controllers/users_controller.rb:127, 169
  • config/initializers/omniauth_strategies/amber_oauth2.rb:9
  • spec/models/user_spec.rb:189

Both keys are defined in config/application.rb (line 39-40), with amber_api_url derived from amber_api_host. Standardize all references to use amber_api_host or clarify the intended configuration approach.

🤖 Prompt for AI Agents
In app/views/partials/_login_prompt.html.erb around line 9 and across the
codebase (app/models/user.rb:56, app/controllers/users_controller.rb:127,169,
config/initializers/omniauth_strategies/amber_oauth2.rb:9,
spec/models/user_spec.rb:189), standardize configuration usage by replacing
references to amber_api_url with amber_api_host (or explicitly derive
amber_api_url from amber_api_host in a single centralized place like
config/application.rb); update each file to read
Rails.application.config.x.amber_api_host (or call a single helper that builds
the full URL from that host) so all code uses the same config key and
tests/initializers are adjusted accordingly.

@codecov

codecov Bot commented Dec 4, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.28%. Comparing base (514b044) to head (5ca83b3).
⚠️ Report is 1 commits behind head on staging.

Additional details and impacted files
@@           Coverage Diff            @@
##           staging    #1144   +/-   ##
========================================
  Coverage    77.28%   77.28%           
========================================
  Files           54       54           
  Lines         1347     1347           
========================================
  Hits          1041     1041           
  Misses         306      306           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lodewiges
lodewiges merged commit 9371d65 into staging Dec 4, 2025
6 checks passed
@lodewiges
lodewiges deleted the hotfix/sofia-accounts branch December 4, 2025 17:29
@coderabbitai coderabbitai Bot mentioned this pull request Dec 7, 2025
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.

2 participants