diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2021-08-11 19:45:49 +0200 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2021-08-13 17:57:19 +0200 |
commit | bb2d5879cc1275ebc552e704589cf608bb91a43d (patch) | |
tree | da25e4a044806cbc4fe882dc7e077cd9824e3766 /lib | |
parent | 0e2aebd036fd49386f373327d933dd380b14b649 (diff) | |
download | pleroma-bb2d5879cc1275ebc552e704589cf608bb91a43d.tar.gz |
maybe_notify_subscribers: Don't create notifications from ingested replies
Backport of: https://git.pleroma.social/pleroma/pleroma/-/merge_requests/3505
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 33639e695..10eb48250 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -412,19 +412,14 @@ defmodule Pleroma.Web.CommonAPI.Utils do def maybe_notify_mentioned_recipients(recipients, _), do: recipients - # Do not notify subscribers if author is making a reply - def maybe_notify_subscribers(recipients, %Activity{ - object: %Object{data: %{"inReplyTo" => _ap_id}} - }) do - recipients - end - def maybe_notify_subscribers( recipients, - %Activity{data: %{"actor" => actor, "type" => type}} = activity - ) - when type == "Create" do - with %User{} = user <- User.get_cached_by_ap_id(actor) do + %Activity{data: %{"actor" => actor, "type" => "Create"}} = activity + ) do + # Do not notify subscribers if author is making a reply + with %Object{data: object} <- Object.normalize(activity, fetch: false), + nil <- object["inReplyTo"], + %User{} = user <- User.get_cached_by_ap_id(actor) do subscriber_ids = user |> User.subscriber_users() |