diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2021-08-11 18:50:39 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2021-08-11 18:50:39 +0000 |
commit | 3ca39ccf69658d095a91e8a61030ecee98b279d8 (patch) | |
tree | 665d57f7fc1fed55bf5d796f9ea55cccab2eb881 /lib | |
parent | 7c1243178b44d629f6881aa1b197641d56bbd0f1 (diff) | |
parent | 436fac3bac8be710951031e069b04412cb8d9c32 (diff) | |
download | pleroma-3ca39ccf69658d095a91e8a61030ecee98b279d8.tar.gz pleroma-3ca39ccf69658d095a91e8a61030ecee98b279d8.zip |
Merge branch 'bugfix/subscriptions-replies' into 'develop'
maybe_notify_subscribers: Normalize Object to check inReplyTo presence
Closes #2732
See merge request pleroma/pleroma!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() |