aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>2021-08-11 19:45:49 +0200
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2021-08-11 20:49:38 +0200
commit436fac3bac8be710951031e069b04412cb8d9c32 (patch)
treec08c42f58b5de033e311eaacd6cdde0c4067dff3
parentc45b3bde949bbbd6b8d6de30022c1d1e5b99dc44 (diff)
downloadpleroma-436fac3bac8be710951031e069b04412cb8d9c32.tar.gz
maybe_notify_subscribers: Don't create notifications from ingested messages
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/pleroma/web/common_api/utils.ex17
2 files changed, 7 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4e3e40864..c07e596b5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
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()