fix: values visible in privacy mode (#1473)

Co-authored-by: yunwei-zh <tspl.fin.guru@gmail.com>
This commit is contained in:
Yunwei Zhang
2026-04-14 14:29:37 -05:00
committed by GitHub
parent 0c58da1a3e
commit 53ea0375db
4 changed files with 17 additions and 3 deletions

View File

@@ -64,6 +64,6 @@
</div>
<div class="shrink-0 col-span-4 lg:col-span-2 ml-auto flex items-center justify-end gap-2">
<%= content_tag :p, format_money(-entry.amount_money) %>
<%= content_tag :p, format_money(-entry.amount_money), class: "privacy-sensitive" %>
</div>
</div>

View File

@@ -25,7 +25,7 @@
</div>
<div class="text-sm">
<span class="text-secondary"><%= t(".amount_label") %></span>
<span class="font-medium <%= @entry.amount.negative? ? "text-green-600" : "text-primary" %>"><%= format_money(@entry.amount_money.abs) %></span>
<span class="font-medium privacy-sensitive <%= @entry.amount.negative? ? "text-green-600" : "text-primary" %>"><%= format_money(@entry.amount_money.abs) %></span>
</div>
</div>

View File

@@ -22,7 +22,7 @@
<p class="text-sm font-medium text-primary"><%= potential_match.name %></p>
<p class="text-xs text-secondary"><%= potential_match.date.strftime("%b %d, %Y") %> • <%= potential_match.account.name %></p>
</div>
<p class="text-sm font-medium <%= potential_match.amount.negative? ? "text-green-600" : "text-primary" %>">
<p class="text-sm font-medium privacy-sensitive <%= potential_match.amount.negative? ? "text-green-600" : "text-primary" %>">
<%= format_money(-potential_match.amount_money) %>
</p>
</div>

View File

@@ -96,6 +96,20 @@ class TransactionsControllerTest < ActionDispatch::IntegrationTest
assert_dom "#total-transactions", count: 1, text: "1"
end
test "split parent rows mark amount as privacy-sensitive" do
entry = create_transaction(account: accounts(:depository), amount: 100, name: "Split parent")
entry.split!([
{ name: "Part 1", amount: 60, category_id: nil },
{ name: "Part 2", amount: 40, category_id: nil }
])
get transactions_url
assert_response :success
assert_select ".split-group > div.opacity-50 p.privacy-sensitive", count: 1
end
test "can paginate" do
family = families(:empty)
sign_in users(:empty)