Merge pull request #5759 from annando/issue-5733

Issue 5733: Removing contacts does work now on the same machine as well
This commit is contained in:
Hypolite Petovan 2018-09-12 19:40:03 -04:00 committed by GitHub
commit 70c94abd8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 8 deletions

View 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'])) : '';

View 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:

View 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;