X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fnotification.ex;h=c7d01f63b83517c36b15779ec9a9772524d5b6d4;hb=19b6a8239387869c69c6885044ee488d097b723f;hp=b5aadfd17eee840293be7fffeb0f326b01ec5bd8;hpb=3dc5f04976293fbcedfc01281f89c4f54c995d59;p=akkoma
diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex
index b5aadfd17..c7d01f63b 100644
--- a/lib/pleroma/notification.ex
+++ b/lib/pleroma/notification.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors
+# Copyright © 2017-2019 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Notification do
@@ -109,7 +109,12 @@ defmodule Pleroma.Notification do
# TODO move to sql, too.
def create_notification(%Activity{} = activity, %User{} = user) do
unless User.blocks?(user, %{ap_id: activity.data["actor"]}) or
- user.ap_id == activity.data["actor"] do
+ user.ap_id == activity.data["actor"] or
+ (activity.data["type"] == "Follow" and
+ Enum.any?(Notification.for_user(user), fn notif ->
+ notif.activity.data["type"] == "Follow" and
+ notif.activity.data["actor"] == activity.data["actor"]
+ end)) do
notification = %Notification{user_id: user.id, activity: activity}
{:ok, notification} = Repo.insert(notification)
Pleroma.Web.Streamer.stream("user", notification)