Merge branch 'master' into ab-eth-get-block-number

pull/1933/head
Ayrat Badykov 6 years ago committed by GitHub
commit a3d712fd19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .dialyzer-ignore
  2. 1
      CHANGELOG.md
  3. 18
      apps/block_scout_web/lib/block_scout_web/views/layout_view.ex
  4. 28
      apps/block_scout_web/test/block_scout_web/views/layout_view_test.exs

@ -4,4 +4,4 @@
apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex:400: Function timestamp_to_datetime/1 has no local return apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex:400: Function timestamp_to_datetime/1 has no local return
apps/explorer/lib/explorer/repo/prometheus_logger.ex:8: Function microseconds_time/1 has no local return apps/explorer/lib/explorer/repo/prometheus_logger.ex:8: Function microseconds_time/1 has no local return
apps/explorer/lib/explorer/repo/prometheus_logger.ex:8: The call 'Elixir.System':convert_time_unit(__@1::any(),'native','microseconds') breaks the contract (integer(),time_unit() | 'native',time_unit() | 'native') -> integer() apps/explorer/lib/explorer/repo/prometheus_logger.ex:8: The call 'Elixir.System':convert_time_unit(__@1::any(),'native','microseconds') breaks the contract (integer(),time_unit() | 'native',time_unit() | 'native') -> integer()
apps/block_scout_web/lib/block_scout_web/views/layout_view.ex:162: The call 'Elixir.Poison.Parser':'parse!'(any(),#{'keys':='atoms!'}) will never return since the success typing is (binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | []),[{atom(),_}]) -> 'false' | 'nil' | 'true' | binary() | ['false' | 'nil' | 'true' | binary() | [any()] | number() | map()] | number() | map() and the contract is (iodata(),'Elixir.Keyword':t()) -> t() apps/block_scout_web/lib/block_scout_web/views/layout_view.ex:174: The call 'Elixir.Poison.Parser':'parse!'(any(),#{'keys':='atoms!'}) will never return since the success typing is (binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | []),[{atom(),_}]) -> 'false' | 'nil' | 'true' | binary() | ['false' | 'nil' | 'true' | binary() | [any()] | number() | map()] | number() | map() and the contract is (iodata(),'Elixir.Keyword':t()) -> t()

@ -54,6 +54,7 @@
- [#1837](https://github.com/poanetwork/blockscout/pull/1837) - Add -f flag to clear_build.sh script delete static folder - [#1837](https://github.com/poanetwork/blockscout/pull/1837) - Add -f flag to clear_build.sh script delete static folder
- [#1900](https://github.com/poanetwork/blockscout/pull/1900) - SUPPORTED_CHAINS ENV var - [#1900](https://github.com/poanetwork/blockscout/pull/1900) - SUPPORTED_CHAINS ENV var
- [#1892](https://github.com/poanetwork/blockscout/pull/1892) - Remove temporary worker modules - [#1892](https://github.com/poanetwork/blockscout/pull/1892) - Remove temporary worker modules
- [#1958](https://github.com/poanetwork/blockscout/pull/1958) - Default value for release link env var
## 1.3.10-beta ## 1.3.10-beta

@ -142,10 +142,22 @@ defmodule BlockScoutWeb.LayoutView do
end end
def release_link(version) do def release_link(version) do
release_link = Application.get_env(:block_scout_web, :release_link) release_link_env_var = Application.get_env(:block_scout_web, :release_link)
if release_link == "" || release_link == nil do release_link =
version cond do
version == "" || version == nil ->
nil
release_link_env_var == "" || release_link_env_var == nil ->
"https://github.com/poanetwork/blockscout/releases/tag/" <> version
true ->
release_link_env_var
end
if release_link == nil do
""
else else
html_escape({:safe, "<a href=\"#{release_link}\" class=\"footer-link\" target=\"_blank\">#{version}</a>"}) html_escape({:safe, "<a href=\"#{release_link}\" class=\"footer-link\" target=\"_blank\">#{version}</a>"})
end end

@ -62,16 +62,32 @@ defmodule BlockScoutWeb.LayoutViewTest do
end end
describe "release_link/1" do describe "release_link/1" do
test "use the version when there is no release_link env configured for it" do test "set empty string if no blockscout version configured" do
Application.put_env(:block_scout_web, :blockscout_version, nil)
assert LayoutView.release_link(nil) == ""
end
test "set empty string if blockscout version is empty string" do
Application.put_env(:block_scout_web, :blockscout_version, "")
assert LayoutView.release_link("") == ""
end
test "use the default value when there is no release_link env configured for it" do
Application.put_env(:block_scout_web, :release_link, nil) Application.put_env(:block_scout_web, :release_link, nil)
assert LayoutView.release_link("1.3.4") == "1.3.4" assert LayoutView.release_link("v1.3.4-beta") ==
{:safe,
~s(<a href="https://github.com/poanetwork/blockscout/releases/tag/v1.3.4-beta" class="footer-link" target="_blank">v1.3.4-beta</a>)}
end end
test "use the version when empty release_link env configured for it" do test "use the default value when empty release_link env configured for it" do
Application.put_env(:block_scout_web, :release_link, "") Application.put_env(:block_scout_web, :release_link, "")
assert LayoutView.release_link("1.3.4") == "1.3.4" assert LayoutView.release_link("v1.3.4-beta") ==
{:safe,
~s(<a href="https://github.com/poanetwork/blockscout/releases/tag/v1.3.4-beta" class="footer-link" target="_blank">v1.3.4-beta</a>)}
end end
test "use the enviroment release link when it's configured" do test "use the enviroment release link when it's configured" do
@ -81,9 +97,9 @@ defmodule BlockScoutWeb.LayoutViewTest do
"https://github.com/poanetwork/blockscout/releases/tag/v1.3.4-beta" "https://github.com/poanetwork/blockscout/releases/tag/v1.3.4-beta"
) )
assert LayoutView.release_link("1.3.4") == assert LayoutView.release_link("v1.3.4-beta") ==
{:safe, {:safe,
~s(<a href="https://github.com/poanetwork/blockscout/releases/tag/v1.3.4-beta" class="footer-link" target="_blank">1.3.4</a>)} ~s(<a href="https://github.com/poanetwork/blockscout/releases/tag/v1.3.4-beta" class="footer-link" target="_blank">v1.3.4-beta</a>)}
end end
end end

Loading…
Cancel
Save