]> git.mxchange.org Git - friendica.git/blobdiff - mod/contacts.php
Merge pull request #5796 from JonnyTischbein/issue_5547
[friendica.git] / mod / contacts.php
index cfe968226df462c69ba52d01eede0b548990baa7..1604f0b6605ec43d6f0e936972ad2394a45c11f2 100644 (file)
@@ -47,6 +47,11 @@ function contacts_init(App $a)
                if (!DBA::isResult($contact)) {
                        $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => 0]);
                }
+
+               // Don't display contacts that are about to be deleted
+               if ($contact['network'] == Protocol::PHANTOM) {
+                       $contact = false;
+               }
        }
 
        if (DBA::isResult($contact)) {
@@ -368,7 +373,7 @@ function _contact_drop($orig_record)
                return;
        }
 
-       Contact::terminateFriendship($r[0], $orig_record);
+       Contact::terminateFriendship($r[0], $orig_record, true);
        Contact::remove($orig_record['id']);
 }
 
@@ -596,17 +601,12 @@ function contacts_content(App $a, $update = 0)
                /// @todo Only show the following link with DFRN when the remote version supports it
                $follow = '';
                $follow_text = '';
-               if (in_array($contact['network'], [Protocol::DIASPORA, Protocol::OSTATUS, Protocol::DFRN])) {
-                       if (in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
+               if (in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
+                       if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
                                $follow = System::baseUrl(true) . "/unfollow?url=" . urlencode($contact["url"]);
                                $follow_text = L10n::t("Disconnect/Unfollow");
-                       } else {
-                               $follow = System::baseUrl(true) . "/follow?url=" . urlencode($contact["url"]);
-                               $follow_text = L10n::t("Connect/Follow");
                        }
-               }
-
-               if ($contact['uid'] == 0) {
+               } else {
                        $follow = System::baseUrl(true) . "/follow?url=" . urlencode($contact["url"]);
                        $follow_text = L10n::t("Connect/Follow");
                }
@@ -724,6 +724,8 @@ function contacts_content(App $a, $update = 0)
                $sql_extra = " AND `blocked` = 0 ";
        }
 
+       $sql_extra .= sprintf(" AND `network` != '%s' ", Protocol::PHANTOM);
+
        $search = x($_GET, 'search') ? notags(trim($_GET['search'])) : '';
        $nets   = x($_GET, 'nets'  ) ? notags(trim($_GET['nets']))   : '';