]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #5759 from annando/issue-5733
authorHypolite Petovan <mrpetovan@eml.cc>
Wed, 12 Sep 2018 23:40:03 +0000 (19:40 -0400)
committerGitHub <noreply@github.com>
Wed, 12 Sep 2018 23:40:03 +0000 (19:40 -0400)
Issue 5733: Removing contacts does work now on the same machine as well

mod/contacts.php
mod/dfrn_notify.php
src/Worker/RemoveContact.php

index 68f68fec3b94f10f97096bd524544acd9d0554d1..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)) {
@@ -719,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']))   : '';
 
index 666c388a4aa7ed917704b0b7b6d69125d8fd4b8d..8a53ac09b6cac594a889a8d0c88833fe97d7c575 100644 (file)
@@ -79,13 +79,13 @@ function dfrn_notify_post(App $a) {
        $condition = [];
        switch ($direction) {
                case (-1):
-                       $condition = ["`issued-id` = ? OR `dfrn-id` = ?", $dfrn_id, $dfrn_id];
+                       $condition = ["(`issued-id` = ? OR `dfrn-id` = ?) AND `uid` = ?", $dfrn_id, $dfrn_id, $user['uid']];
                        break;
                case 0:
-                       $condition = ['issued-id' => $dfrn_id, 'duplex' => true];
+                       $condition = ['issued-id' => $dfrn_id, 'duplex' => true, 'uid' => $user['uid']];
                        break;
                case 1:
-                       $condition = ['dfrn-id' => $dfrn_id, 'duplex' => true];
+                       $condition = ['dfrn-id' => $dfrn_id, 'duplex' => true, 'uid' => $user['uid']];
                        break;
                default:
                        System::xmlExit(3, 'Invalid direction');
@@ -287,15 +287,15 @@ function dfrn_notify_content(App $a) {
                $condition = [];
                switch ($direction) {
                        case (-1):
-                               $condition = ["`issued-id` = ? OR `dfrn-id` = ?", $dfrn_id, $dfrn_id];
+                               $condition = ["(`issued-id` = ? OR `dfrn-id` = ?) AND `uid` = ?", $dfrn_id, $dfrn_id, $user['uid']];
                                $my_id = $dfrn_id;
                                break;
                        case 0:
-                               $condition = ['issued-id' => $dfrn_id, 'duplex' => true];
+                               $condition = ['issued-id' => $dfrn_id, 'duplex' => true, 'uid' => $user['uid']];
                                $my_id = '1:' . $dfrn_id;
                                break;
                        case 1:
-                               $condition = ['dfrn-id' => $dfrn_id, 'duplex' => true];
+                               $condition = ['dfrn-id' => $dfrn_id, 'duplex' => true, 'uid' => $user['uid']];
                                $my_id = '0:' . $dfrn_id;
                                break;
                        default:
index b07661b7a9068dc6cc6505887081d04e5db6ba1b..8f986eab11559c18630315429dd783910dfa9205 100644 (file)
@@ -13,8 +13,8 @@ require_once 'include/dba.php';
 class RemoveContact {
        public static function execute($id) {
 
-               // Only delete if the contact is archived
-               $condition = ['archive' => true, 'network' => Protocol::PHANTOM, 'id' => $id];
+               // Only delete if the contact is to be deleted
+               $condition = ['network' => Protocol::PHANTOM, 'id' => $id];
                $r = DBA::exists('contact', $condition);
                if (!DBA::isResult($r)) {
                        return;