use Friendica\App;
use Friendica\BaseModule;
-use Friendica\Contact\LocalRelationship\Entity;
-use Friendica\Contact\LocalRelationship\Repository;
+use Friendica\Contact\LocalRelationship;
use Friendica\Content\ContactSelector;
use Friendica\Content\Nav;
use Friendica\Content\Text\BBCode;
use Friendica\Module\Response;
use Friendica\Navigation\SystemMessages;
use Friendica\Network\HTTPException;
+use Friendica\User\Settings;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
private $systemMessages;
/** @var Database */
private $db;
+ /** @var Settings\Repository\UserGServer */
+ private $userGServer;
- public function __construct(Database $db, SystemMessages $systemMessages, IHandleUserSessions $session, L10n $l10n, Repository\LocalRelationship $localRelationship, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, App\Page $page, IManageConfigValues $config, array $server, array $parameters = [])
+ public function __construct(Settings\Repository\UserGServer $userGServer, Database $db, SystemMessages $systemMessages, IHandleUserSessions $session, L10n $l10n, LocalRelationship\Repository\LocalRelationship $localRelationship, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, App\Page $page, IManageConfigValues $config, array $server, array $parameters = [])
{
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->session = $session;
$this->systemMessages = $systemMessages;
$this->db = $db;
+ $this->userGServer = $userGServer;
}
protected function post(array $request = [])
$fields['info'] = $_POST['info'];
}
+ if (isset($_POST['channel_frequency'])) {
+ Contact\User::setChannelFrequency($cdata['user'], $this->session->getLocalUserId(), $_POST['channel_frequency']);
+ }
+
if (!Contact::update($fields, ['id' => $cdata['user'], 'uid' => $this->session->getLocalUserId()])) {
$this->systemMessages->addNotice($this->t('Failed to update contact record.'));
}
$insecure = $this->t('Private communications are not available for this contact.');
+ // @TODO: Figure out why gsid can be empty
+ if (empty($contact['gsid'])) {
+ $this->logger->notice('Empty gsid for contact', ['contact' => $contact]);
+ }
+
+ $serverIgnored =
+ $contact['gsid'] &&
+ $this->userGServer->isIgnoredByUser($this->session->getLocalUserId(), $contact['gsid']) ?
+ $this->t('This contact is on a server you ignored.')
+ : '';
+
$last_update = (($contact['last-update'] <= DBA::NULL_DATETIME) ? $this->t('Never') : DateTimeFormat::local($contact['last-update'], 'D, j M Y, g:i A'));
if ($contact['last-update'] > DBA::NULL_DATETIME) {
$localRelationship->fetchFurtherInformation,
$this->t('Fetch information like preview pictures, title and teaser from the feed item. You can activate this if the feed doesn\'t contain much text. Keywords are taken from the meta header in the feed item and are posted as hash tags.'),
[
- Entity\LocalRelationship::FFI_NONE => $this->t('Disabled'),
- Entity\LocalRelationship::FFI_INFORMATION => $this->t('Fetch information'),
- Entity\LocalRelationship::FFI_KEYWORD => $this->t('Fetch keywords'),
- Entity\LocalRelationship::FFI_BOTH => $this->t('Fetch information and keywords')
+ LocalRelationship\Entity\LocalRelationship::FFI_NONE => $this->t('Disabled'),
+ LocalRelationship\Entity\LocalRelationship::FFI_INFORMATION => $this->t('Fetch information'),
+ LocalRelationship\Entity\LocalRelationship::FFI_KEYWORD => $this->t('Fetch keywords'),
+ LocalRelationship\Entity\LocalRelationship::FFI_BOTH => $this->t('Fetch information and keywords')
]
];
}
];
}
+ $channel_frequency = Contact\User::getChannelFrequency($contact['id'], $this->session->getLocalUserId());
+
$poll_interval = null;
if ((($contact['network'] == Protocol::FEED) && !$this->config->get('system', 'adjust_poll_frequency')) || ($contact['network'] == Protocol::MAIL)) {
$poll_interval = ContactSelector::pollInterval($localRelationship->priority, !$poll_enabled);
'$collapsed' => $localRelationship->collapsed ? $this->t('Currently collapsed') : '',
'$archived' => ($contact['archive'] ? $this->t('Currently archived') : ''),
'$insecure' => (in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::MAIL, Protocol::DIASPORA]) ? '' : $insecure),
+ '$serverIgnored' => $serverIgnored,
+ '$manageServers' => $this->t('Manage remote servers'),
'$cinfo' => ['info', '', $localRelationship->info, ''],
'$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')],
'$notify_new_posts' => ['notify_new_posts', $this->t('Notification for new posts'), ($localRelationship->notifyNewPosts), $this->t('Send a notification of every new post of this contact')],
$this->t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'),
$remote_self_options
],
+ '$channel_settings_label' => $this->t('Channel Settings'),
+ '$frequency_label' => $this->t('Frequency of this contact in relevant channels'),
+ '$frequency_description' => $this->t("Depending on the type of the channel not all posts from this contact are displayed. By default, posts need to have a minimum amount of interactions (comments, likes) to show in your channels. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don't want to see their content at all, but you don't want to block or hide the contact completely."),
+ '$frequency_default' => ['channel_frequency', $this->t('Default frequency'), Contact\User::FREQUENCY_DEFAULT, $this->t('Posts by this contact are displayed in the "for you" channel if you interact often with this contact or if a post reached some level of interaction.'), $channel_frequency == Contact\User::FREQUENCY_DEFAULT],
+ '$frequency_always' => ['channel_frequency', $this->t('Display all posts of this contact'), Contact\User::FREQUENCY_ALWAYS, $this->t('All posts from this contact will appear on the "for you" channel'), $channel_frequency == Contact\User::FREQUENCY_ALWAYS],
+ '$frequency_reduced' => ['channel_frequency', $this->t('Display only few posts'), Contact\User::FREQUENCY_REDUCED, $this->t('When a contact creates a lot of posts in a short period, this setting reduces the number of displayed posts in every channel.'), $channel_frequency == Contact\User::FREQUENCY_REDUCED],
+ '$frequency_never' => ['channel_frequency', $this->t('Never display posts'), Contact\User::FREQUENCY_NEVER, $this->t('Posts from this contact will never be displayed in any channel'), $channel_frequency == Contact\User::FREQUENCY_NEVER],
]);
$arr = ['contact' => $contact, 'output' => $o];
* This includes actions like e.g. 'block', 'hide', 'delete' and others
*
* @param array $contact Public contact row
- * @param Entity\LocalRelationship $localRelationship
+ * @param LocalRelationship\Entity\LocalRelationship $localRelationship
* @return array with contact related actions
* @throws HTTPException\InternalServerErrorException
*/
- private function getContactActions(array $contact, Entity\LocalRelationship $localRelationship): array
+ private function getContactActions(array $contact, LocalRelationship\Entity\LocalRelationship $localRelationship): array
{
$poll_enabled = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
$contact_actions = [];