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
4 changes: 2 additions & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def update_with_sofia_account # rubocop:disable Metrics/AbcSize, Metrics/MethodL
end
authorize @sofia_account

if @user.update(params.require(:user).permit(%i[email] + (current_user.treasurer? ? %i[name deactivated] : []),
if @user.update(params.require(:user).permit(%i[email sub_provider] + (current_user.treasurer? ? %i[name deactivated] : []),
sofia_account_attributes: %i[id username]))
flash[:success] = 'Gegevens gewijzigd'
else
Expand All @@ -167,6 +167,6 @@ def find_or_create_user(user_json) # rubocop:disable Metrics/AbcSize, Metrics/Me
end

def permitted_attributes
params.require(:user).permit(%w[name email provider])
params.require(:user).permit(%w[name email provider sub_provider])
end
end
3 changes: 3 additions & 0 deletions app/views/users/_edit_sofia_account_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<%= f.input :name, label: 'Naam', placeholder: 'Naam', required: true %>
<% end %>
<%= f.input :email, label: 'E-mailadres', placeholder: 'E-mailadres', required: true %>
<% if Rails.application.config.x.subprovider_label.present? %>
<%= f.input :sub_provider, label: 'SubProvider', placeholder: Rails.application.config.x.subprovider_label, required: true, input_html: { style: 'text-transform: uppercase;', onkeyup: 'this.value = this.value.toUpperCase();' } %>
<% end %>
<% if current_user.treasurer? %>
<div class="row">
<div class="col-lg-3">
Expand Down
3 changes: 3 additions & 0 deletions app/views/users/_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<div class="modal-body" id="activities_modal">
<%= f.input :name, label: 'Naam', placeholder: 'Naam', required: true %>
<%= f.input :email, label: 'E-mailadres', placeholder: 'E-mailadres' %>
<% if Rails.application.config.x.subprovider_label.present? %>
<%= f.input :sub_provider, label: 'Subprovider', placeholder: Rails.application.config.x.subprovider_label, required: true, input_html: { style: 'text-transform: uppercase;', onkeyup: 'this.value = this.value.toUpperCase();' } %>
<% end %>
Comment on lines +16 to +18
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Standardize the label capitalization.

The label 'Subprovider' here differs from 'SubProvider' used in _edit_sofia_account_modal.html.erb (line 25). For consistency, use the same capitalization across both modals.

Note: A previous review comment already flagged that uppercase transformation should be implemented server-side.

🔎 Suggested fix to match the edit modal's capitalization:
-            <%= f.input :sub_provider, label: 'Subprovider', placeholder: Rails.application.config.x.subprovider_label, required: true, input_html: { style: 'text-transform: uppercase;', onkeyup: 'this.value = this.value.toUpperCase();' } %>
+            <%= f.input :sub_provider, label: 'SubProvider', placeholder: Rails.application.config.x.subprovider_label, required: true, input_html: { style: 'text-transform: uppercase;', onkeyup: 'this.value = this.value.toUpperCase();' } %>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<% if Rails.application.config.x.subprovider_label.present? %>
<%= f.input :sub_provider, label: 'Subprovider', placeholder: Rails.application.config.x.subprovider_label, required: true, input_html: { style: 'text-transform: uppercase;', onkeyup: 'this.value = this.value.toUpperCase();' } %>
<% end %>
<% if Rails.application.config.x.subprovider_label.present? %>
<%= f.input :sub_provider, label: 'SubProvider', placeholder: Rails.application.config.x.subprovider_label, required: true, input_html: { style: 'text-transform: uppercase;', onkeyup: 'this.value = this.value.toUpperCase();' } %>
<% end %>
🤖 Prompt for AI Agents
In app/views/users/_modal.html.erb around lines 16 to 18, the input label reads
'Subprovider' but should match the capitalization used in
_edit_sofia_account_modal.html.erb ('SubProvider'); update the f.input label to
'SubProvider' for consistency and ensure the form still relies on server-side
normalization for uppercase (do not remove existing client-side transform).

<% if @new_user.persisted? %>
<div class="row">
<div class="col-lg-3">
Expand Down
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class Application < Rails::Application
config.x.site_short_name = ENV.fetch('SITE_SHORT_NAME', 'SOFIA')
config.x.site_long_name = ENV.fetch('SITE_LONG_NAME', 'Streepsysteem voor de Ordentelijke Festiviteiten van Inleggend Alpha')
config.x.site_association = ENV.fetch('SITE_ASSOCIATION', 'C.S.V. Alpha')

Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The new SUBPROVIDER_LABEL environment variable is not documented in the .env.example file. This file should include all available environment variables with example values to help developers configure the application correctly. Consider adding a line like 'SUBPROVIDER_LABEL=Subprovider' to document this new configuration option.

Copilot uses AI. Check for mistakes.
config.x.subprovider_label = ENV.fetch('SUBPROVIDER_LABEL', nil)
config.x.deposit_button_enabled = ENV.fetch('DEPOSIT_BUTTON_ENABLED', 'true') == 'true'

config.x.min_payment_amount = [ENV.fetch('MIN_PAYMENT_AMOUNT', '21.8').to_f, 0.01].max
Expand Down