use Friendica\BaseObject;
use Friendica\Content\Pager;
-use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
WHERE `gid` = ?
AND `contact`.`uid` = ?
AND NOT `contact`.`self`
+ AND NOT `contact`.`deleted`
AND NOT `contact`.`blocked`
AND NOT `contact`.`pending`
ORDER BY `contact`.`name` ASC',
'gender' => $profile['gender'], 'avatar' => $profile['photo'],
'contact-type' => $user['account-type'], 'xmpp' => $profile['xmpp']];
- $avatar = DBA::selectFirst('photo', ['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
+ $avatar = Photo::selectFirst(['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
if (DBA::isResult($avatar)) {
if ($update_avatar) {
$fields['avatar-date'] = DateTimeFormat::utcNow();
*/
public static function terminateFriendship(array $user, array $contact, $dissolve = false)
{
+ if (empty($contact['network'])) {
+ return;
+ }
if (($contact['network'] == Protocol::DFRN) && $dissolve) {
DFRN::deliver($user, $contact, 'placeholder', true);
} elseif (in_array($contact['network'], [Protocol::OSTATUS, Protocol::DFRN])) {
} elseif ($contact['network'] == Protocol::DIASPORA) {
Diaspora::sendUnshare($user, $contact);
} elseif ($contact['network'] == Protocol::ACTIVITYPUB) {
- ActivityPub\Transmitter::sendContactUndo($contact['url'], $user['uid']);
+ ActivityPub\Transmitter::sendContactUndo($contact['url'], $contact['id'], $user['uid']);
if ($dissolve) {
ActivityPub\Transmitter::sendContactReject($contact['url'], $contact['hub-verify'], $user['uid']);
Logger::log('Empty contact: ' . json_encode($contact) . ' - ' . System::callstack(20), Logger::DEBUG);
}
+ Logger::log('Contact '.$contact['id'].' is marked for archival', Logger::DEBUG);
+
// Contact already archived or "self" contact? => nothing to do
if ($contact['archive'] || $contact['self']) {
return;
return;
}
+ Logger::log('Contact '.$contact['id'].' is marked as vital again', Logger::DEBUG);
+
if (!isset($contact['url']) && !empty($contact['id'])) {
$fields = ['id', 'url', 'batch'];
$contact = DBA::selectFirst('contact', [], ['id' => $contact['id']]);
$args = ['contact' => $contact, 'menu' => &$menu];
- Addon::callHooks('contact_photo_menu', $args);
+ Hook::callAll('contact_photo_menu', $args);
$menucondensed = [];
FROM `contact`
WHERE `uid` = %d
AND NOT `self`
+ AND NOT `deleted`
AND NOT `blocked`
AND NOT `pending`
AND `id` NOT IN (
$items = Item::inArray($r);
- $o = conversation($a, $items, $pager, 'contacts', $update);
+ $o = conversation($a, $items, $pager, 'contacts', $update, false, 'commented', local_user());
} else {
$r = Item::selectForUser(local_user(), [], $condition, $params);
$ret = Probe::uri($contact["url"], $network);
- // If Probe::uri fails the network code will be different
- if (($ret["network"] != $contact["network"]) && !in_array($ret["network"], [Protocol::ACTIVITYPUB, $network])) {
+ // If Probe::uri fails the network code will be different (mostly "feed" or "unkn")
+ if (($ret["network"] != $contact["network"]) && !in_array($ret["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, $network])) {
return false;
}
$ret = Diaspora::sendShare($a->user, $contact);
Logger::log('share returns: ' . $ret);
} elseif ($contact['network'] == Protocol::ACTIVITYPUB) {
- $ret = ActivityPub\Transmitter::sendActivity('Follow', $contact['url'], $uid);
+ $activity_id = ActivityPub\Transmitter::activityIDFromContact($contact_id);
+ if (empty($activity_id)) {
+ // This really should never happen
+ return false;
+ }
+
+ $ret = ActivityPub\Transmitter::sendActivity('Follow', $contact['url'], $uid, $activity_id);
Logger::log('Follow returns: ' . $ret);
}
}
*/
public static function magicLink($contact_url, $url = '')
{
- if (!local_user() && remote_user()) {
+ if (!local_user() && !remote_user()) {
return $url ?: $contact_url; // Equivalent to: ($url != '') ? $url : $contact_url;
}