From 28b25fb96cfac4363abe627ac387fe7ca3b8d2fe Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 19 Feb 2020 17:03:29 +0300 Subject: [PATCH] Fix token instance QR code data --- CHANGELOG.md | 1 + .../lib/block_scout_web/views/api_docs_view.ex | 10 ++++++---- .../views/tokens/instance/overview_view.ex | 5 +++-- apps/block_scout_web/priv/gettext/default.pot | 4 ++-- .../priv/gettext/en/LC_MESSAGES/default.po | 4 ++-- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16869df2f8..3323bd479c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - [#2834](https://github.com/poanetwork/blockscout/pull/2834) - always redirect to checksummed hash ### Fixes +- [#3016](https://github.com/poanetwork/blockscout/pull/3016) - Fix token instance QR code data - [#3012](https://github.com/poanetwork/blockscout/pull/3012) - Speedup token transfers list query - [#3011](https://github.com/poanetwork/blockscout/pull/3011) - Revert realtime fetcher small skips feature - [#3009](https://github.com/poanetwork/blockscout/pull/3009) - Fix broken export to CSV diff --git a/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex index 08ccab4256..4ac79494e5 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex @@ -34,7 +34,7 @@ defmodule BlockScoutWeb.APIDocsView do end) end - def blockscout_url(is_api) do + def blockscout_url(is_api, set_path) do url_params = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url] host = url_params[:host] @@ -48,7 +48,7 @@ defmodule BlockScoutWeb.APIDocsView do scheme = Keyword.get(url_params, :scheme, "http") if host != "localhost" do - "#{scheme}://#{host}#{path}" + if set_path, do: "#{scheme}://#{host}#{path}", else: "#{scheme}://#{host}" else port = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:http][:port] "#{scheme}://#{host}:#{to_string(port)}" @@ -57,17 +57,19 @@ defmodule BlockScoutWeb.APIDocsView do def api_url do is_api = true + set_path = true is_api - |> blockscout_url() + |> blockscout_url(set_path) |> Path.join("api") end def eth_rpc_api_url do is_api = true + set_path = true is_api - |> blockscout_url() + |> blockscout_url(set_path) |> Path.join("api/eth_rpc") end end diff --git a/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex b/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex index 3ad44bfcd5..35fc32ee43 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex @@ -4,7 +4,7 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do alias BlockScoutWeb.CurrencyHelpers alias Explorer.Chain.{Address, SmartContract, Token} - import BlockScoutWeb.APIDocsView, only: [blockscout_url: 1] + import BlockScoutWeb.APIDocsView, only: [blockscout_url: 2] @tabs ["token_transfers", "metadata"] @@ -56,7 +56,8 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do token_instance_path = token_instance_path(conn, :show, to_string(hash), to_string(token_id)) is_api = false - url = Path.join(blockscout_url(is_api), token_instance_path) + set_path = false + url = Path.join(blockscout_url(is_api, set_path), token_instance_path) url |> QRCode.to_png() diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index d6a156da84..6e87c32ef3 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -898,7 +898,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 #: lib/block_scout_web/views/address_view.ex:308 -#: lib/block_scout_web/views/tokens/instance/overview_view.ex:72 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:73 #: lib/block_scout_web/views/tokens/overview_view.ex:35 #: lib/block_scout_web/views/transaction_view.ex:314 msgid "Token Transfers" @@ -1774,7 +1774,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18 #: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 -#: lib/block_scout_web/views/tokens/instance/overview_view.ex:73 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:74 msgid "Metadata" msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index d6a156da84..6e87c32ef3 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -898,7 +898,7 @@ msgstr "" #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 #: lib/block_scout_web/views/address_view.ex:308 -#: lib/block_scout_web/views/tokens/instance/overview_view.ex:72 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:73 #: lib/block_scout_web/views/tokens/overview_view.ex:35 #: lib/block_scout_web/views/transaction_view.ex:314 msgid "Token Transfers" @@ -1774,7 +1774,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18 #: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 -#: lib/block_scout_web/views/tokens/instance/overview_view.ex:73 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:74 msgid "Metadata" msgstr ""