Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix nft token instance images #2753

Merged
merged 8 commits into from
Oct 8, 2019
Merged

Conversation

ayrat555
Copy link
Contributor

@ayrat555 ayrat555 commented Oct 4, 2019

Changelog

  • allow images from ['properties']['image']['description'] in nft token
  • allow images from all sources

@coveralls
Copy link

coveralls commented Oct 4, 2019

Pull Request Test Coverage Report for Build 38be72c2-f4e1-4432-aff9-56c2bafb7a94

  • 7 of 10 (70.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 77.812%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex 7 10 70.0%
Totals Coverage Status
Change from base Build 68148591-b09c-4e1a-bd49-1797782f2f4e: 0.03%
Covered Lines: 5320
Relevant Lines: 6837

💛 - Coveralls

Copy link
Member

@vbaranov vbaranov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Copy link
Contributor

@pasqu4le pasqu4le left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one suggestion

image_src(nil)
end

if String.trim(result) == "", do: image_src(nil), else: result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just my opinion, but this function definition seems unnecessarily repetitive.
It could be changed into:

  def image_src(instance) do
    [ 
      instance.metadata["image_url"],
      instance.metadata["image"],
      instance.metadata["properties"]["image"]["description"],
      image_src(nil)
    ]
    |> Enum.find(& not is_nil(&1) and String.trim(&1) != "")
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants