The personal finance app for everyone (by everyone)
Ruby
fix: values visible in privacy mode (#1473)
Yunwei Zhang53ea0375db68
diff --git a/app/views/transactions/_split_parent_row.html.erb b/app/views/transactions/_split_parent_row.html.erbindex 70b44ebd2c..6813609c38 100644--- a/app/views/transactions/_split_parent_row.html.erb+++ b/app/views/transactions/_split_parent_row.html.erb@@ -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>diff --git a/app/views/transactions/convert_to_trade.html.erb b/app/views/transactions/convert_to_trade.html.erbindex 5c0f972700..b7e04524dd 100644--- a/app/views/transactions/convert_to_trade.html.erb+++ b/app/views/transactions/convert_to_trade.html.erb@@ -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>diff --git a/app/views/transactions/show.html.erb b/app/views/transactions/show.html.erbindex eb7dbb4cf7..5c1176d030 100644--- a/app/views/transactions/show.html.erb+++ b/app/views/transactions/show.html.erb@@ -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>diff --git a/test/controllers/transactions_controller_test.rb b/test/controllers/transactions_controller_test.rbindex 8c79b793e5..546f58be01 100644--- a/test/controllers/transactions_controller_test.rb+++ b/test/controllers/transactions_controller_test.rb@@ -96,6 +96,20 @@ class TransactionsControllerTest < ActionDispatch::IntegrationTestassert_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" dofamily = families(:empty)sign_in users(:empty)