Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/partials/_login_prompt.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</h3>
</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.

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.

<li class="list-group-item">
<p class="card-text mt-2">
Log in met een <%= Rails.application.config.x.site_association %> account.
Expand Down
12 changes: 6 additions & 6 deletions app/views/users/_edit_sofia_account_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<% if @sofia_account && policy(@sofia_account).update_with_sofia_account? %>
<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>
<h5 class="mb-0 py-1">Gegevens <i class="fas fa-caret-down float-end me-1"></i></h5>
</div>
<div class="collapse card-body" id="user-data-collapse">
<%= simple_form_for @user, wrapper: :horizontal_form, url: update_with_sofia_account_user_path, method: :patch do |f| %>
Expand Down Expand Up @@ -38,7 +38,7 @@

<div class="card mb-3">
<div class="card-header py-2" type="button" data-bs-toggle="collapse" data-bs-target="#password-collapse" aria-expanded="false" aria-controls="password-collapse">
<h5 class="mb-0 py-1">Wachtwoord <%= fa_icon 'caret-down', class: 'float-end me-1' %></h5>
<h5 class="mb-0 py-1">Wachtwoord <i class="fas fa-caret-down float-end me-1"></i></h5>
</div>
<div class="collapse card-body" id="password-collapse">
<%= simple_form_for @sofia_account, wrapper: :horizontal_form, url: update_password_sofia_account_path(@sofia_account.id), method: :patch do |f| %>
Expand All @@ -52,7 +52,7 @@

<div class="card mb-3">
<div class="card-header py-2" type="button" data-bs-toggle="collapse" data-bs-target="#otp-collapse" aria-expanded="false" aria-controls="otp-collapse">
<h5 class="mb-0 py-1">Two-factor-authenticatie <%= fa_icon 'caret-down', class: 'float-end me-1' %></h5>
<h5 class="mb-0 py-1">Two-factor-authenticatie <i class="fas fa-caret-down float-end me-1"></i></h5>
</div>
<div class="collapse card-body" id="otp-collapse">
<p>
Expand Down Expand Up @@ -86,7 +86,7 @@

<ul>
<li>
<%= fa_icon 'android', class: 'me-1' %>
<i class="fab fa-android me-1"></i>
<a
href='https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2'
target='_blank'
Expand All @@ -95,7 +95,7 @@
</a>
</li>
<li>
<%= fa_icon 'apple', class: 'me-1' %>
<i class="fab fa-apple me-1"></i>
<a
href='https://itunes.apple.com/us/app/authenticator/id766157276?mt=8'
target='_blank'
Expand All @@ -104,7 +104,7 @@
</a>
</li>
<li>
<%= fa_icon 'windows', class: 'me-1' %>
<i class="fab fa-windows me-1"></i>
<a
href='https://www.microsoft.com/en-us/store/p/microsoft-authenticator/9nblgggzmcj6'
target='_blank'
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>
<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 class="d-flex justify-content-between align-items-center">
<h3><%= Rails.application.config.x.site_association %> gebruikers</h3>
<% if policy(User).refresh_user_list? %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</table>
<% if @sofia_account && policy(@sofia_account).update_with_sofia_account? %>
<button class="btn btn-sm btn-primary pull-right ms-2" data-bs-target="#edit_sofia_account_modal" data-bs-toggle="modal" role="button">
<%= fa_icon 'sliders', class: 'me-1' %>
<i class="fas fa-sliders-h me-1"></i>
Instellingen
</button>
<% end %>
Expand Down