Use with instead of if in the card
authorrinpatch <rinpatch@sdf.org>
Sat, 2 Feb 2019 09:04:18 +0000 (12:04 +0300)
committerrinpatch <rinpatch@sdf.org>
Sat, 2 Feb 2019 09:04:18 +0000 (12:04 +0300)
lib/pleroma/web/mastodon_api/views/status_view.ex

index aa38784a69ffaa835333699a0d82a1f6df16ea67..c8fde93bae6a66b078036a2bcacbb7b0a8407a26 100644 (file)
@@ -186,11 +186,12 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
     page_url_data = URI.parse(page_url)
 
     image_url =
-      if %URI{host: nil} = page_url_data do
+      with %URI{host: nil} <- page_url_data do
         rich_media[:image]
       else
-        URI.merge(page_url_data, URI.parse(rich_media[:image]))
-        |> to_string
+        _ ->
+          URI.merge(page_url_data, URI.parse(rich_media[:image]))
+          |> to_string
       end
 
     site_name = rich_media[:site_name] || page_url_data.host