From 24dc6778cf7a44bb5d1f8dd40d1cb8678fdc10c8 Mon Sep 17 00:00:00 2001 From: rene0422 Date: Mon, 25 May 2026 08:43:40 -0700 Subject: [PATCH 1/3] fix(family-sharing): scope form/import account lists to accessible_accounts (#1803) --- app/controllers/transactions_controller.rb | 2 +- app/views/import/uploads/show.html.erb | 6 +++--- app/views/transactions/_form.html.erb | 2 +- app/views/transfers/_form.html.erb | 2 +- test/controllers/import/uploads_controller_test.rb | 13 +++++++++++++ test/controllers/transactions_controller_test.rb | 13 +++++++++++++ test/controllers/transfers_controller_test.rb | 13 +++++++++++++ 7 files changed, 45 insertions(+), 6 deletions(-) diff --git a/app/controllers/transactions_controller.rb b/app/controllers/transactions_controller.rb index fbcd89c189..4d645b1a50 100644 --- a/app/controllers/transactions_controller.rb +++ b/app/controllers/transactions_controller.rb @@ -371,7 +371,7 @@ def update_preferences end def exchange_rate - account = Current.family.accounts.find(params[:account_id]) + account = Current.user.accessible_accounts.find(params[:account_id]) currency_from = params[:currency] date = params[:date]&.to_date || Date.current diff --git a/app/views/import/uploads/show.html.erb b/app/views/import/uploads/show.html.erb index 7cf51d6514..e6622bbdc7 100644 --- a/app/views/import/uploads/show.html.erb +++ b/app/views/import/uploads/show.html.erb @@ -56,7 +56,7 @@ <%= styled_form_with model: @import, scope: :import, url: import_upload_path(@import), multipart: true, class: "space-y-4" do |form| %> <%= form.select :account_id, - @import.family.accounts.visible.alphabetically.pluck(:name, :id), + accessible_accounts.visible.alphabetically.pluck(:name, :id), { label: t(".qif_account_label"), include_blank: t(".qif_account_placeholder"), selected: @import.account_id }, required: true %> @@ -112,7 +112,7 @@ <%= form.select :col_sep, Import.separator_options, label: true %> <% if @import.type == "TransactionImport" || @import.type == "TradeImport" %> - <%= form.select :account_id, @import.family.accounts.visible.alphabetically.pluck(:name, :id), { label: t(".account_optional_label"), include_blank: t(".multi_account_import"), selected: @import.account_id } %> + <%= form.select :account_id, accessible_accounts.visible.alphabetically.pluck(:name, :id), { label: t(".account_optional_label"), include_blank: t(".multi_account_import"), selected: @import.account_id } %> <% end %>