The personal finance app for everyone
Ensure transfer name is populated (#1042)
Zach Gollwitzerc70c8b6d86d3
diff --git a/app/models/account/transfer.rb b/app/models/account/transfer.rbindex 975e0440..85fa9406 100644--- a/app/models/account/transfer.rb+++ b/app/models/account/transfer.rb@@ -9,19 +9,18 @@ class Account::Transfer < ApplicationRecordenddef amount_money- entries.first&.amount_money&.abs+ entries.first&.amount_money&.abs || Money.new(0)enddef from_name- outflow_transaction&.account&.name+ outflow_transaction&.account&.name || I18n.t("account.transfer.from_fallback_name")enddef to_name- inflow_transaction&.account&.name+ inflow_transaction&.account&.name || I18n.t("account.transfer.to_fallback_name")enddef name- return nil unless from_name && to_nameI18n.t("account.transfer.name", from_account: from_name, to_account: to_name)enddiff --git a/app/views/account/transfers/_transfer.html.erb b/app/views/account/transfers/_transfer.html.erbindex 3b2bcc28..4dbfc26a 100644--- a/app/views/account/transfers/_transfer.html.erb+++ b/app/views/account/transfers/_transfer.html.erb@@ -11,7 +11,7 @@<%= tag.div class: short ? "max-w-[250px]" : "max-w-[325px]" do %><div class="flex items-center gap-2">- <%= circle_logo("T") %>+ <%= circle_logo(transfer.from_name[0].upcase) %><%= tag.p transfer.name, class: "truncate text-gray-900" %></div>diff --git a/config/locales/models/account/transfer/en.yml b/config/locales/models/account/transfer/en.ymlindex 877aeb8b..dc33084d 100644--- a/config/locales/models/account/transfer/en.yml+++ b/config/locales/models/account/transfer/en.yml@@ -2,4 +2,6 @@en:account:transfer:+ from_fallback_name: Originatorname: Transfer from %{from_account} to %{to_account}+ to_fallback_name: Receiver