Commit 3ca39ccf authored by Haelwenn's avatar Haelwenn
Browse files

Merge branch 'bugfix/subscriptions-replies' into 'develop'

maybe_notify_subscribers: Normalize Object to check inReplyTo presence

Closes #2732

See merge request !3505
parents 7c124317 436fac3b
Pipeline #37077 passed with stages
in 93 minutes and 6 seconds
......@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
### Fixed
- Subscription(Bell) Notifications: Don't create from Pipeline Ingested replies
### Removed
......
......@@ -412,19 +412,14 @@ def maybe_notify_mentioned_recipients(
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()
......
Markdown is supported
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