]> git.mxchange.org Git - friendica.git/commitdiff
Add check for relationship with remote user for connect display
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 13 Dec 2018 03:22:43 +0000 (22:22 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 13 Dec 2018 03:22:43 +0000 (22:22 -0500)
src/Model/Profile.php

index a73c8410b31ba12a114b85cf8e31fee9d2c93c8b..5f040f63ecc595d1e3053c9cf2dc4ee947f8fc56 100644 (file)
@@ -99,7 +99,7 @@ class Profile
         *      load a lot of theme-specific content
         *
         * @brief Loads a profile into the page sidebar.
-        * @param object  $a            App
+        * @param App     $a
         * @param string  $nickname     string
         * @param int     $profile      int
         * @param array   $profiledata  array
@@ -337,6 +337,17 @@ class Profile
                        }
                }
 
+               // Is the remote user already connected to that user?
+               if ($connect && remote_user()
+                       && DBA::exists('contact', [
+                               'uid'  => $profile['uid'],
+                               'nurl' => Strings::normaliseLink(self::getMyURL()),
+                               'rel'  => [Contact::SHARING, Contact::FRIEND]
+                       ])
+               ) {
+                       $connect = false;
+               }
+
                if ($connect && ($profile['network'] != Protocol::DFRN) && !isset($profile['remoteconnect'])) {
                        $connect = false;
                }