Close privacy mode gaps on accounts, budget editing, and account activity (#1495)

* Initial plan

* Hide missed values in privacy mode

Agent-Logs-Url: https://github.com/we-promise/sure/sessions/ba225f77-fcf1-4d79-8f89-da446e77fab6

Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>

* Tighten privacy mode test coverage

Agent-Logs-Url: https://github.com/we-promise/sure/sessions/ba225f77-fcf1-4d79-8f89-da446e77fab6

Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>

* Polish privacy mode assertions

Agent-Logs-Url: https://github.com/we-promise/sure/sessions/ba225f77-fcf1-4d79-8f89-da446e77fab6

Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>

* Refine privacy mode tests

Agent-Logs-Url: https://github.com/we-promise/sure/sessions/ba225f77-fcf1-4d79-8f89-da446e77fab6

Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>

* Restore budget privacy mode form interactivity

Agent-Logs-Url: https://github.com/we-promise/sure/sessions/f3c51447-290c-421f-9cad-e8ff88c91d2f

Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
This commit is contained in:
Copilot
2026-04-19 18:12:03 +02:00
committed by GitHub
parent b32e9dbc45
commit cb842d0d9b
7 changed files with 37 additions and 8 deletions

View File

@@ -1,6 +1,8 @@
require "test_helper"
class AccountsControllerTest < ActionDispatch::IntegrationTest
include ActionView::RecordIdentifier
setup do
sign_in @user = users(:family_admin)
@account = accounts(:depository)
@@ -9,6 +11,7 @@ class AccountsControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get accounts_url
assert_response :success
assert_select "p.ml-auto.privacy-sensitive"
end
test "should get show" do
@@ -16,6 +19,16 @@ class AccountsControllerTest < ActionDispatch::IntegrationTest
assert_response :success
end
test "account activity marks trade amounts as privacy-sensitive" do
trade_entry = entries(:trade)
expected_amount = ApplicationController.helpers.format_money(-trade_entry.amount_money)
get account_url(accounts(:investment))
assert_response :success
assert_select "turbo-frame##{dom_id(trade_entry)} p.privacy-sensitive", text: expected_amount, count: 1
end
test "activity pagination keeps activity tab when loaded from holdings tab" do
investment = accounts(:investment)

View File

@@ -50,6 +50,19 @@ class BudgetCategoriesControllerTest < ActionDispatch::IntegrationTest
)
end
test "index marks budget form values as privacy-sensitive" do
parent_form_selector = "##{dom_id(@parent_budget_category, :form)}"
uncategorized_form_selector = "##{dom_id(@budget, :uncategorized_budget_category_form)}"
get budget_budget_categories_path(@budget)
assert_response :success
assert_select "#{parent_form_selector} .privacy-sensitive.privacy-sensitive-interactive input##{dom_id(@parent_budget_category, :budgeted_spending)}"
assert_select "#{parent_form_selector} p.text-secondary.privacy-sensitive", text: /\/m avg/
assert_select "#{uncategorized_form_selector} .privacy-sensitive input[name='uncategorized']"
assert_select "#{uncategorized_form_selector} p.text-secondary.privacy-sensitive", text: /\/m avg/
end
test "updating a subcategory adjusts the parent budget by the same delta" do
assert_changes -> { @parent_budget_category.reload.budgeted_spending.to_f }, from: 500.0, to: 550.0 do
patch budget_budget_category_path(@budget, @electric_budget_category),