From 25ee96d97a373c9d3a396058e09401489c04d475 Mon Sep 17 00:00:00 2001 From: Oleg Sovetnik Date: Tue, 29 Mar 2022 00:54:35 +0300 Subject: [PATCH] Fix nil comparsion and list conversion errors --- .../lib/explorer/accounts/notify/notifier.ex | 1 + .../explorer/lib/explorer/accounts/notify/summary.ex | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/explorer/lib/explorer/accounts/notify/notifier.ex b/apps/explorer/lib/explorer/accounts/notify/notifier.ex index 6860cec4be..b9477b5d5a 100644 --- a/apps/explorer/lib/explorer/accounts/notify/notifier.ex +++ b/apps/explorer/lib/explorer/accounts/notify/notifier.ex @@ -118,6 +118,7 @@ defmodule Explorer.Accounts.Notify.Notifier do method: summary.method, block_number: summary.block_number, amount: summary.amount, + subject: summary.subject, tx_fee: summary.tx_fee, name: summary.name, type: summary.type diff --git a/apps/explorer/lib/explorer/accounts/notify/summary.ex b/apps/explorer/lib/explorer/accounts/notify/summary.ex index ad26424a55..d097fdbc29 100644 --- a/apps/explorer/lib/explorer/accounts/notify/summary.ex +++ b/apps/explorer/lib/explorer/accounts/notify/summary.ex @@ -83,6 +83,7 @@ defmodule Explorer.Accounts.Notify.Summary do amount: amount(transaction), tx_fee: fee(transaction), name: Application.get_env(:explorer, :coin_name), + subject: "Coin transaction", type: "COIN" } end @@ -104,6 +105,7 @@ defmodule Explorer.Accounts.Notify.Summary do to_address_hash: transfer.to_address_hash, block_number: transfer.block_number, amount: amount(transfer), + subject: transfer.token.type, tx_fee: fee(transaction), name: transfer.token.name, type: transfer.token.type @@ -131,7 +133,7 @@ defmodule Explorer.Accounts.Notify.Summary do from_address_hash: transfer.from_address_hash, to_address_hash: transfer.to_address_hash, block_number: transfer.block_number, - subject: to_string(token_ids(transfer)), + subject: token_ids(transfer), tx_fee: fee(transaction), name: transfer.token.name, type: transfer.token.type @@ -177,7 +179,13 @@ defmodule Explorer.Accounts.Notify.Summary do end def token_ids(%Chain.TokenTransfer{token_id: token_id, token_ids: token_ids}) do - token_id || token_ids + case token_id do + nil -> + Enum.map_join(token_ids, ", ", fn id -> to_string(id) end) + + _ -> + to_string(token_id) + end end def token_decimals(%Chain.TokenTransfer{} = transfer) do