token balances display fix

pull/3311/head^2
Victor Baranov 4 years ago
parent 35a6edd6de
commit 54ce4a9e3b
  1. 12
      apps/block_scout_web/lib/block_scout_web/controllers/address_token_balance_controller.ex
  2. 1
      apps/block_scout_web/lib/block_scout_web/views/transaction_internal_transaction_view.ex

@ -6,17 +6,25 @@ defmodule BlockScoutWeb.AddressTokenBalanceController do
def index(conn, %{"address_id" => address_hash_string} = params) do def index(conn, %{"address_id" => address_hash_string} = params) do
with true <- ajax?(conn), with true <- ajax?(conn),
{:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string) do
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do
token_balances = token_balances =
address_hash address_hash
|> Chain.fetch_last_token_balances() |> Chain.fetch_last_token_balances()
|> Market.add_price() |> Market.add_price()
case AccessHelpers.restricted_access?(address_hash_string, params) do
{:ok, false} ->
conn conn
|> put_status(200) |> put_status(200)
|> put_layout(false) |> put_layout(false)
|> render("_token_balances.html", token_balances: token_balances) |> render("_token_balances.html", token_balances: token_balances)
_ ->
conn
|> put_status(200)
|> put_layout(false)
|> render("_token_balances.html", token_balances: [])
end
else else
_ -> _ ->
not_found(conn) not_found(conn)

@ -1,5 +1,4 @@
defmodule BlockScoutWeb.TransactionInternalTransactionView do defmodule BlockScoutWeb.TransactionInternalTransactionView do
use BlockScoutWeb, :view use BlockScoutWeb, :view
@dialyzer :no_match @dialyzer :no_match
end end

Loading…
Cancel
Save