From 47017a64326354a1e5f817f9ac65c159b489f0de Mon Sep 17 00:00:00 2001 From: Josh Pigford Date: Wed, 30 Apr 2025 14:29:33 -0500 Subject: [PATCH] Enhance account links in transfers view to handle missing accounts gracefully. Added conditional checks to display a warning message when account data is unavailable. --- app/views/transfers/_account_links.html.erb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/views/transfers/_account_links.html.erb b/app/views/transfers/_account_links.html.erb index a71b7de0..f7ba4365 100644 --- a/app/views/transfers/_account_links.html.erb +++ b/app/views/transfers/_account_links.html.erb @@ -1,7 +1,24 @@ <%# locals: (transfer:, is_inflow: false) %>
<% first_account, second_account = is_inflow ? [transfer.to_account, transfer.from_account] : [transfer.from_account, transfer.to_account] %> - <%= link_to first_account.name, account_path(first_account, tab: "activity"), class: "hover:underline", data: { turbo_frame: "_top" } %> + + <%# Check if first_account exists before creating link %> + <% if first_account %> + <%= link_to first_account.name, account_path(first_account, tab: "activity"), class: "hover:underline", data: { turbo_frame: "_top" } %> + <% else %> + + Data Error: Missing account + + <% end %> + <%= lucide_icon is_inflow ? "arrow-left" : "arrow-right", class: "w-4 h-4 shrink-0" %> - <%= link_to second_account.name, account_path(second_account, tab: "activity"), class: "hover:underline", data: { turbo_frame: "_top" } %> + + <%# Check if second_account exists before creating link %> + <% if second_account %> + <%= link_to second_account.name, account_path(second_account, tab: "activity"), class: "hover:underline", data: { turbo_frame: "_top" } %> + <% else %> + + Data Error: Missing account + + <% end %>