]> git.mxchange.org Git - friendica.git/commitdiff
Prevent multiple send follow requests
authorMichael <heluecht@pirati.ca>
Sun, 10 Feb 2019 18:03:01 +0000 (18:03 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 10 Feb 2019 18:03:01 +0000 (18:03 +0000)
src/Protocol/ActivityPub/Transmitter.php

index 1032627b32911a92613036c56908558a5ad73aae..ebd32786a82e603a86e0db4f2ad1780980417e72 100644 (file)
@@ -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,