Don't show deleted contacts, set new AP contacts as "pending" until they are accepted
This commit is contained in:
parent
3b80f335fa
commit
6ae6a8a983
3 changed files with 18 additions and 14 deletions
|
@ -101,7 +101,7 @@ class ACL extends BaseObject
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = DBA::p("SELECT `id`, `name`, `url`, `network` FROM `contact`
|
$stmt = DBA::p("SELECT `id`, `name`, `url`, `network` FROM `contact`
|
||||||
WHERE `uid` = ? AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
|
WHERE `uid` = ? AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND NOT `deleted` AND `notify` != ''
|
||||||
$sql_extra
|
$sql_extra
|
||||||
ORDER BY `name` ASC ", intval(local_user())
|
ORDER BY `name` ASC ", intval(local_user())
|
||||||
);
|
);
|
||||||
|
@ -166,7 +166,7 @@ class ACL extends BaseObject
|
||||||
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\"$tabindex_attr$hidepreselected>\r\n";
|
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\"$tabindex_attr$hidepreselected>\r\n";
|
||||||
|
|
||||||
$stmt = DBA::p("SELECT `id`, `name`, `url`, `network` FROM `contact`
|
$stmt = DBA::p("SELECT `id`, `name`, `url`, `network` FROM `contact`
|
||||||
WHERE `uid` = ? AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
|
WHERE `uid` = ? AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND NOT `deleted` AND `notify` != ''
|
||||||
$sql_extra
|
$sql_extra
|
||||||
ORDER BY `name` ASC ", intval(local_user())
|
ORDER BY `name` ASC ", intval(local_user())
|
||||||
);
|
);
|
||||||
|
|
|
@ -1739,6 +1739,8 @@ class Contact extends BaseObject
|
||||||
|
|
||||||
$hidden = (($ret['network'] === Protocol::MAIL) ? 1 : 0);
|
$hidden = (($ret['network'] === Protocol::MAIL) ? 1 : 0);
|
||||||
|
|
||||||
|
$pending = in_array($ret['network'], [Protocol::ACTIVITYPUB]);
|
||||||
|
|
||||||
if (in_array($ret['network'], [Protocol::MAIL, Protocol::DIASPORA, Protocol::ACTIVITYPUB])) {
|
if (in_array($ret['network'], [Protocol::MAIL, Protocol::DIASPORA, Protocol::ACTIVITYPUB])) {
|
||||||
$writeable = 1;
|
$writeable = 1;
|
||||||
}
|
}
|
||||||
|
@ -1774,7 +1776,7 @@ class Contact extends BaseObject
|
||||||
'hidden' => $hidden,
|
'hidden' => $hidden,
|
||||||
'blocked' => 0,
|
'blocked' => 0,
|
||||||
'readonly'=> 0,
|
'readonly'=> 0,
|
||||||
'pending' => 0,
|
'pending' => $pending,
|
||||||
'subhub' => $subhub
|
'subhub' => $subhub
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,10 +51,10 @@ class Contact extends BaseModule
|
||||||
|| $a->argc == 3 && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])
|
|| $a->argc == 3 && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])
|
||||||
) {
|
) {
|
||||||
$contact_id = intval($a->argv[1]);
|
$contact_id = intval($a->argv[1]);
|
||||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
|
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false]);
|
||||||
|
|
||||||
if (!DBA::isResult($contact)) {
|
if (!DBA::isResult($contact)) {
|
||||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => 0]);
|
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => 0, 'deleted' => false]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't display contacts that are about to be deleted
|
// Don't display contacts that are about to be deleted
|
||||||
|
@ -135,7 +135,7 @@ class Contact extends BaseModule
|
||||||
|
|
||||||
$contacts_id = $_POST['contact_batch'];
|
$contacts_id = $_POST['contact_batch'];
|
||||||
|
|
||||||
$stmt = DBA::select('contact', ['id', 'archive'], ['id' => $contacts_id, 'uid' => local_user(), 'self' => false]);
|
$stmt = DBA::select('contact', ['id', 'archive'], ['id' => $contacts_id, 'uid' => local_user(), 'self' => false, 'deleted' => false]);
|
||||||
$orig_records = DBA::toArray($stmt);
|
$orig_records = DBA::toArray($stmt);
|
||||||
|
|
||||||
$count_actions = 0;
|
$count_actions = 0;
|
||||||
|
@ -188,7 +188,7 @@ class Contact extends BaseModule
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
|
if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false])) {
|
||||||
notice(L10n::t('Could not access contact record.') . EOL);
|
notice(L10n::t('Could not access contact record.') . EOL);
|
||||||
$a->internalRedirect('contact');
|
$a->internalRedirect('contact');
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
|
@ -198,7 +198,7 @@ class Contact extends BaseModule
|
||||||
|
|
||||||
$profile_id = intval(defaults($_POST, 'profile-assign', 0));
|
$profile_id = intval(defaults($_POST, 'profile-assign', 0));
|
||||||
if ($profile_id) {
|
if ($profile_id) {
|
||||||
if (!DBA::exists('profile', ['id' => $profile_id, 'uid' => local_user()])) {
|
if (!DBA::exists('profile', ['id' => $profile_id, 'uid' => local_user(), 'deleted' => false])) {
|
||||||
notice(L10n::t('Could not locate selected profile.') . EOL);
|
notice(L10n::t('Could not locate selected profile.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ class Contact extends BaseModule
|
||||||
notice(L10n::t('Failed to update contact record.') . EOL);
|
notice(L10n::t('Failed to update contact record.') . EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user()]);
|
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false]);
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
$a->data['contact'] = $contact;
|
$a->data['contact'] = $contact;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ class Contact extends BaseModule
|
||||||
|
|
||||||
private static function updateContactFromPoll($contact_id)
|
private static function updateContactFromPoll($contact_id)
|
||||||
{
|
{
|
||||||
$contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
|
$contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false]);
|
||||||
if (!DBA::isResult($contact)) {
|
if (!DBA::isResult($contact)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ class Contact extends BaseModule
|
||||||
|
|
||||||
private static function updateContactFromProbe($contact_id)
|
private static function updateContactFromProbe($contact_id)
|
||||||
{
|
{
|
||||||
$contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user()]);
|
$contact = DBA::selectFirst('contact', ['uid', 'url', 'network'], ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false]);
|
||||||
if (!DBA::isResult($contact)) {
|
if (!DBA::isResult($contact)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ class Contact extends BaseModule
|
||||||
|
|
||||||
$cmd = $a->argv[2];
|
$cmd = $a->argv[2];
|
||||||
|
|
||||||
$orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => [0, local_user()], 'self' => false]);
|
$orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => [0, local_user()], 'self' => false, 'deleted' => false]);
|
||||||
if (!DBA::isResult($orig_record)) {
|
if (!DBA::isResult($orig_record)) {
|
||||||
notice(L10n::t('Could not access contact record.') . EOL);
|
notice(L10n::t('Could not access contact record.') . EOL);
|
||||||
$a->internalRedirect('contact');
|
$a->internalRedirect('contact');
|
||||||
|
@ -778,6 +778,8 @@ class Contact extends BaseModule
|
||||||
$sql_extra .= sprintf(" AND network = '%s' ", DBA::escape($nets));
|
$sql_extra .= sprintf(" AND network = '%s' ", DBA::escape($nets));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql_extra .= " AND NOT `deleted` ";
|
||||||
|
|
||||||
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= Model\Contact::FRIEND)) ? sprintf(" AND `rel` = %d ", intval($sort_type)) : '');
|
$sql_extra2 = ((($sort_type > 0) && ($sort_type <= Model\Contact::FRIEND)) ? sprintf(" AND `rel` = %d ", intval($sort_type)) : '');
|
||||||
|
|
||||||
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
||||||
|
@ -937,7 +939,7 @@ class Contact extends BaseModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact = DBA::selectFirst('contact', ['uid', 'url', 'id'], ['id' => $contact_id]);
|
$contact = DBA::selectFirst('contact', ['uid', 'url', 'id'], ['id' => $contact_id, 'deleted' => false]);
|
||||||
|
|
||||||
if (!$update) {
|
if (!$update) {
|
||||||
$o .= self::getTabsHTML($a, $contact, 1);
|
$o .= self::getTabsHTML($a, $contact, 1);
|
||||||
|
@ -961,7 +963,7 @@ class Contact extends BaseModule
|
||||||
|
|
||||||
private static function getPostsHTML($a, $contact_id)
|
private static function getPostsHTML($a, $contact_id)
|
||||||
{
|
{
|
||||||
$contact = DBA::selectFirst('contact', ['uid', 'url', 'id'], ['id' => $contact_id]);
|
$contact = DBA::selectFirst('contact', ['uid', 'url', 'id'], ['id' => $contact_id, 'deleted' => false]);
|
||||||
|
|
||||||
$o = self::getTabsHTML($a, $contact, 2);
|
$o = self::getTabsHTML($a, $contact, 2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue