From 58eaf0ba1c42e49d5cede907a0bd5939629764f6 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 10 Feb 2019 18:03:01 +0000 Subject: [PATCH] Prevent multiple send follow requests --- src/Protocol/ActivityPub/Transmitter.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 1032627b32..ebd32786a8 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -1317,6 +1317,13 @@ class Transmitter $uid = $first_user['uid']; } + $condition = ['verb' => ACTIVITY_FOLLOW, 'uid' => 0, 'parent-uri' => $object, + 'author-id' => Contact::getPublicIdByUserId($uid)]; + if (Item::exists($condition)) { + Logger::log('Follow for ' . $object . ' for user ' . $uid . ' does already exist.', Logger::DEBUG); + return false; + } + $owner = User::getOwnerDataById($uid); $data = ['@context' => ActivityPub::CONTEXT, -- 2.39.5