-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Conversation
Pull Request Test Coverage Report for Build 38be72c2-f4e1-4432-aff9-56c2bafb7a94
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
Changelog