aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-06-04 19:22:49 +0200
committerlain <lain@soykaf.club>2020-06-04 19:22:49 +0200
commit56dfa0e0fb0ca34054930e64e092f4a3a1b87fd1 (patch)
tree62ee7ae9d1d15e58e7049bcb8dec1ff4090f82a2
parent00748e9650e911d828dfe6f769ac20a6b31c8b69 (diff)
downloadpleroma-56dfa0e0fb0ca34054930e64e092f4a3a1b87fd1.tar.gz
Transmogrifier: Update notification after accepting.
-rw-r--r--lib/pleroma/web/activity_pub/transmogrifier.ex1
-rw-r--r--test/web/activity_pub/transmogrifier/follow_handling_test.exs9
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
index 886403fcd..b2461de2b 100644
--- a/lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -538,6 +538,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
{_, false} <- {:user_blocked, User.blocks?(followed, follower) && deny_follow_blocked},
{_, false} <- {:user_locked, User.locked?(followed)},
{_, {:ok, follower}} <- {:follow, User.follow(follower, followed)},
+ _ <- Notification.update_notification_type(followed, activity),
{_, {:ok, _}} <-
{:follow_state_update, Utils.update_follow_state_for_all(activity, "accept")},
{:ok, _relationship} <-
diff --git a/test/web/activity_pub/transmogrifier/follow_handling_test.exs b/test/web/activity_pub/transmogrifier/follow_handling_test.exs
index 967389fae..6b003b51c 100644
--- a/test/web/activity_pub/transmogrifier/follow_handling_test.exs
+++ b/test/web/activity_pub/transmogrifier/follow_handling_test.exs
@@ -5,6 +5,7 @@
defmodule Pleroma.Web.ActivityPub.Transmogrifier.FollowHandlingTest do
use Pleroma.DataCase
alias Pleroma.Activity
+ alias Pleroma.Notification
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Web.ActivityPub.Transmogrifier
@@ -57,9 +58,12 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.FollowHandlingTest do
activity = Repo.get(Activity, activity.id)
assert activity.data["state"] == "accept"
assert User.following?(User.get_cached_by_ap_id(data["actor"]), user)
+
+ [notification] = Notification.for_user(user)
+ assert notification.type == "follow"
end
- test "with locked accounts, it does not create a follow or an accept" do
+ test "with locked accounts, it does create a Follow, but not an Accept" do
user = insert(:user, locked: true)
data =
@@ -81,6 +85,9 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.FollowHandlingTest do
|> Repo.all()
assert Enum.empty?(accepts)
+
+ [notification] = Notification.for_user(user)
+ assert notification.type == "follow_request"
end
test "it works for follow requests when you are already followed, creating a new accept activity" do