Commit 6f36e903 authored by minibikini's avatar minibikini
Browse files

use `User.avatar_url`

parent 79668c08
......@@ -68,7 +68,7 @@ def handle_cast(
Logger.error("Web Push Nonification failed with code: #{code}")
:error
data ->
_ ->
Logger.error("Web Push Nonification failed with unknown error")
:error
end
......@@ -86,7 +86,7 @@ def format(%{activity: %{data: %{"type" => "Create"}}}, actor) do
%{
title: "New Mention",
body: "@#{actor.nickname} has mentiond you",
icon: get_avatar_url(actor)
icon: User.avatar_url(actor)
}
end
......@@ -94,7 +94,7 @@ def format(%{activity: %{data: %{"type" => "Follow"}}}, actor) do
%{
title: "New Follower",
body: "@#{actor.nickname} has followed you",
icon: get_avatar_url(actor)
icon: User.avatar_url(actor)
}
end
......@@ -102,7 +102,7 @@ def format(%{activity: %{data: %{"type" => "Announce"}}}, actor) do
%{
title: "New Announce",
body: "@#{actor.nickname} has announced your post",
icon: get_avatar_url(actor)
icon: User.avatar_url(actor)
}
end
......@@ -110,18 +110,7 @@ def format(%{activity: %{data: %{"type" => "Like"}}}, actor) do
%{
title: "New Like",
body: "@#{actor.nickname} has liked your post",
icon: get_avatar_url(actor)
icon: User.avatar_url(actor)
}
end
def get_avatar_url(%{avatar: %{"type" => "Image", "url" => urls}}) do
case List.first(urls) do
%{"href" => url} -> url
_ -> get_avatar_url(nil)
end
end
def get_avatar_url(_) do
Pleroma.Web.Endpoint.static_url() <> "/images/avi.png"
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment