aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/pleroma/web/common_api/utils.ex6
-rw-r--r--test/notification_test.exs18
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex
index fcc000969..6f0f56d96 100644
--- a/lib/pleroma/web/common_api/utils.ex
+++ b/lib/pleroma/web/common_api/utils.ex
@@ -439,6 +439,12 @@ defmodule Pleroma.Web.CommonAPI.Utils do
def maybe_notify_mentioned_recipients(recipients, _), do: recipients
+ def maybe_notify_subscribers(_, %Activity{
+ data: %{"object" => %Object{data: %{"inReplyTo" => _ap_id}}}
+ }) do
+ :nothing
+ end
+
def maybe_notify_subscribers(
recipients,
%Activity{data: %{"actor" => actor, "type" => type}} = activity
diff --git a/test/notification_test.exs b/test/notification_test.exs
index dda570b49..06f0b6557 100644
--- a/test/notification_test.exs
+++ b/test/notification_test.exs
@@ -42,6 +42,24 @@ defmodule Pleroma.NotificationTest do
assert notification.user_id == subscriber.id
end
+
+ test "does not create a notification for subscribed users if status is a reply" do
+ user = insert(:user)
+ other_user = insert(:user)
+ subscriber = insert(:user)
+
+ User.subscribe(subscriber, other_user)
+
+ {:ok, activity} = CommonAPI.post(user, %{"status" => "test post"})
+
+ {:ok, reply_activity} =
+ CommonAPI.post(other_user, %{
+ "status" => "test reply",
+ "in_reply_to_status_id" => activity.id
+ })
+
+ refute Notification.create_notification(reply_activity, subscriber)
+ end
end
describe "create_notification" do