diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2020-01-23 11:11:18 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2020-01-23 11:11:18 +0300 |
commit | 5fc2fa89086e820352a9fec571f07f29a55c4f06 (patch) | |
tree | 7e4f4d2cce9182c9ecd70af9925a5a201a13b999 /lib | |
parent | ce7c887a27ad5af59f540650637a50da7f91fa52 (diff) | |
parent | dddebee047efc4ab1dff6565bef32954695846a7 (diff) | |
download | pleroma-5fc2fa89086e820352a9fec571f07f29a55c4f06.tar.gz |
Merge branch 'develop' into issue/1383
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/activity.ex | 3 | ||||
-rw-r--r-- | lib/pleroma/notification.ex | 4 | ||||
-rw-r--r-- | lib/pleroma/object/fetcher.ex | 3 | ||||
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 4 | ||||
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/notification_view.ex | 31 |
5 files changed, 36 insertions, 9 deletions
diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index 896cbb3c5..0f8fce774 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -30,7 +30,8 @@ defmodule Pleroma.Activity do "Follow" => "follow", "Announce" => "reblog", "Like" => "favourite", - "Move" => "move" + "Move" => "move", + "EmojiReaction" => "pleroma:emoji_reaction" } @mastodon_to_ap_notification_types for {k, v} <- @mastodon_notification_types, diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index 8f3e46af9..d04a65a1e 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -294,7 +294,7 @@ defmodule Pleroma.Notification do end def create_notifications(%Activity{data: %{"type" => type}} = activity) - when type in ["Like", "Announce", "Follow", "Move"] do + when type in ["Like", "Announce", "Follow", "Move", "EmojiReaction"] do notifications = activity |> get_notified_from_activity() @@ -322,7 +322,7 @@ defmodule Pleroma.Notification do def get_notified_from_activity(activity, local_only \\ true) def get_notified_from_activity(%Activity{data: %{"type" => type}} = activity, local_only) - when type in ["Create", "Like", "Announce", "Follow", "Move"] do + when type in ["Create", "Like", "Announce", "Follow", "Move", "EmojiReaction"] do [] |> Utils.maybe_notify_to_recipients(activity) |> Utils.maybe_notify_mentioned_recipients(activity) diff --git a/lib/pleroma/object/fetcher.ex b/lib/pleroma/object/fetcher.ex index a1bde90f1..037c42339 100644 --- a/lib/pleroma/object/fetcher.ex +++ b/lib/pleroma/object/fetcher.ex @@ -117,6 +117,9 @@ defmodule Pleroma.Object.Fetcher do {:error, %Tesla.Mock.Error{}} -> nil + {:error, "Object has been deleted"} -> + nil + e -> Logger.error("Error while fetching #{id}: #{inspect(e)}") nil diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 60c9e7e64..2e9d56ee5 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1369,6 +1369,10 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do data <- maybe_update_follow_information(data) do {:ok, data} else + {:error, "Object has been deleted"} = e -> + Logger.debug("Could not decode user at fetch #{ap_id}, #{inspect(e)}") + {:error, e} + e -> Logger.error("Could not decode user at fetch #{ap_id}, #{inspect(e)}") {:error, e} diff --git a/lib/pleroma/web/mastodon_api/views/notification_view.ex b/lib/pleroma/web/mastodon_api/views/notification_view.ex index ddd7f5318..360ec10f0 100644 --- a/lib/pleroma/web/mastodon_api/views/notification_view.ex +++ b/lib/pleroma/web/mastodon_api/views/notification_view.ex @@ -37,18 +37,37 @@ defmodule Pleroma.Web.MastodonAPI.NotificationView do } case mastodon_type do - "mention" -> put_status(response, activity, user) - "favourite" -> put_status(response, parent_activity, user) - "reblog" -> put_status(response, parent_activity, user) - "move" -> put_target(response, activity, user) - "follow" -> response - _ -> nil + "mention" -> + put_status(response, activity, user) + + "favourite" -> + put_status(response, parent_activity, user) + + "reblog" -> + 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 else _ -> 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 |