X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fmastodon_api%2Fviews%2Fnotification_view.ex;h=360ec10f0cdc864b25f91dd628231b433ed49fc6;hb=6fab5fe7f892b5a9cf4d605b079e544583f0ce73;hp=5e3dbe728335d09dbd70b641bcb22c0e63349dc6;hpb=5dc14c89cecc121ffb047c2a7c972af0b0f89ef8;p=akkoma diff --git a/lib/pleroma/web/mastodon_api/views/notification_view.ex b/lib/pleroma/web/mastodon_api/views/notification_view.ex index 5e3dbe728..360ec10f0 100644 --- a/lib/pleroma/web/mastodon_api/views/notification_view.ex +++ b/lib/pleroma/web/mastodon_api/views/notification_view.ex @@ -38,26 +38,23 @@ defmodule Pleroma.Web.MastodonAPI.NotificationView do case mastodon_type do "mention" -> - response - |> Map.merge(%{ - status: StatusView.render("show.json", %{activity: activity, for: user}) - }) + put_status(response, activity, user) "favourite" -> - response - |> Map.merge(%{ - status: StatusView.render("show.json", %{activity: parent_activity, for: user}) - }) + put_status(response, parent_activity, user) "reblog" -> - response - |> Map.merge(%{ - status: StatusView.render("show.json", %{activity: parent_activity, for: user}) - }) + put_status(response, parent_activity, user) + + "move" -> + put_target(response, activity, user) "follow" -> response + "pleroma:emoji_reaction" -> + put_status(response, parent_activity, user) |> put_emoji(activity) + _ -> nil end @@ -65,4 +62,18 @@ defmodule Pleroma.Web.MastodonAPI.NotificationView do _ -> nil end end + + defp put_emoji(response, activity) do + response + |> Map.put(:emoji, activity.data["content"]) + end + + defp put_status(response, activity, user) do + Map.put(response, :status, StatusView.render("show.json", %{activity: activity, for: user})) + end + + defp put_target(response, activity, user) do + target = User.get_cached_by_ap_id(activity.data["target"]) + Map.put(response, :target, AccountView.render("show.json", %{user: target, for: user})) + end end