<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
Contact\User::setIgnored($contact['id'], DI::userSession()->getLocalUserId(), true);
$message = $this->t('Contact has been ignored');
}
+
+ // @TODO: add $this->localRelationship->save($localRelationship);
+ DI::sysmsg()->addInfo($message);
+ }
+
+ if ($cmd === 'collapse') {
+ if ($localRelationship->collapsed) {
+ // @TODO Backward compatibility, replace with $localRelationship->unblock()
+ Contact\User::setCollapsed($contact['id'], DI::userSession()->getLocalUserId(), false);
+ $message = $this->t('Contact has been uncollapsed');
+ } else {
+ // @TODO Backward compatibility, replace with $localRelationship->block()
+ Contact\User::setCollapsed($contact['id'], DI::userSession()->getLocalUserId(), true);
+ $message = $this->t('Contact has been collapsed');
+ }
+
// @TODO: add $this->localRelationship->save($localRelationship);
DI::sysmsg()->addInfo($message);
}
}
$url = Contact::magicLinkByContact($contact);
- if (strpos($url, 'redir/') === 0) {
+ if (strpos($url, 'contact/redir/') === 0) {
$sparkle = ' class="sparkle" ';
} else {
$sparkle = '';
if ($contact['network'] == Protocol::FEED) {
$remote_self_options = [
Contact::MIRROR_DEACTIVATED => $this->t('No mirroring'),
- Contact::MIRROR_FORWARDED => $this->t('Mirror as forwarded posting'),
Contact::MIRROR_OWN_POST => $this->t('Mirror as my own posting')
];
} elseif ($contact['network'] == Protocol::ACTIVITYPUB) {
'$submit' => $this->t('Submit'),
'$lbl_info1' => $lbl_info1,
'$lbl_info2' => $this->t('Their personal note'),
- '$reason' => trim($contact['reason']),
+ '$reason' => trim($contact['reason'] ?? ''),
'$infedit' => $this->t('Edit contact notes'),
'$common_link' => 'contact/' . $contact['id'] . '/contacts/common',
'$relation_text' => $relation_text,
'$cinfo' => ['info', '', $localRelationship->info, ''],
'$blocked' => ($contact['blocked'] ? $this->t('Currently blocked') : ''),
'$ignored' => ($contact['readonly'] ? $this->t('Currently ignored') : ''),
+ '$collapsed' => (Contact\User::isCollapsed($contact['id'], DI::userSession()->getLocalUserId()) ? $this->t('Currently collapsed') : ''),
'$archived' => ($contact['archive'] ? $this->t('Currently archived') : ''),
'$pending' => ($contact['pending'] ? $this->t('Awaiting connection acknowledge') : ''),
'$hidden' => ['hidden', $this->t('Hide this contact from others'), $localRelationship->hidden, $this->t('Replies/likes to your public posts <strong>may</strong> still be visible')],
'id' => 'toggle-ignore',
];
+ $contact_actions['collapse'] = [
+ 'label' => $localRelationship->collapsed ? $this->t('Uncollapse') : $this->t('Collapse'),
+ 'url' => 'contact/' . $contact['id'] . '/collapse?t=' . $formSecurityToken,
+ 'title' => $this->t('Toggle Collapsed status'),
+ 'sel' => $localRelationship->collapsed ? 'active' : '',
+ 'id' => 'toggle-collapse',
+ ];
+
if (Protocol::supportsRevokeFollow($contact['network']) && in_array($localRelationship->rel, [Contact::FOLLOWER, Contact::FRIEND])) {
$contact_actions['revoke_follow'] = [
'label' => $this->t('Revoke Follow'),