mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-11 17:44:27 +02:00
Merge remote-tracking branch 'upstream/develop' into subscription
This commit is contained in:
commit
ff6d14a022
53 changed files with 2238 additions and 1133 deletions
|
@ -46,6 +46,8 @@ use Friendica\Network\HTTPException\InternalServerErrorException;
|
|||
use Friendica\Object\Post as PostObject;
|
||||
use Friendica\Object\Thread;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\User\Settings\Entity\UserGServer;
|
||||
use Friendica\User\Settings\Repository;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Profiler;
|
||||
|
@ -91,22 +93,25 @@ class Conversation
|
|||
private $mode;
|
||||
/** @var IHandleUserSessions */
|
||||
private $session;
|
||||
/** @var Repository\UserGServer */
|
||||
private $userGServer;
|
||||
|
||||
public function __construct(LoggerInterface $logger, Profiler $profiler, Activity $activity, L10n $l10n, Item $item, Arguments $args, BaseURL $baseURL, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, App\Page $page, App\Mode $mode, App $app, IHandleUserSessions $session)
|
||||
public function __construct(Repository\UserGServer $userGServer, LoggerInterface $logger, Profiler $profiler, Activity $activity, L10n $l10n, Item $item, Arguments $args, BaseURL $baseURL, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, App\Page $page, App\Mode $mode, App $app, IHandleUserSessions $session)
|
||||
{
|
||||
$this->activity = $activity;
|
||||
$this->item = $item;
|
||||
$this->config = $config;
|
||||
$this->mode = $mode;
|
||||
$this->baseURL = $baseURL;
|
||||
$this->profiler = $profiler;
|
||||
$this->logger = $logger;
|
||||
$this->l10n = $l10n;
|
||||
$this->args = $args;
|
||||
$this->pConfig = $pConfig;
|
||||
$this->page = $page;
|
||||
$this->app = $app;
|
||||
$this->session = $session;
|
||||
$this->activity = $activity;
|
||||
$this->item = $item;
|
||||
$this->config = $config;
|
||||
$this->mode = $mode;
|
||||
$this->baseURL = $baseURL;
|
||||
$this->profiler = $profiler;
|
||||
$this->logger = $logger;
|
||||
$this->l10n = $l10n;
|
||||
$this->args = $args;
|
||||
$this->pConfig = $pConfig;
|
||||
$this->page = $page;
|
||||
$this->app = $app;
|
||||
$this->session = $session;
|
||||
$this->userGServer = $userGServer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -460,8 +465,14 @@ class Conversation
|
|||
|
||||
$live_update_div = '';
|
||||
|
||||
$userGservers = $this->userGServer->listIgnoredByUser($this->session->getLocalUserId());
|
||||
|
||||
$ignoredGsids = array_map(function (UserGServer $userGServer) {
|
||||
return $userGServer->gsid;
|
||||
}, $userGservers->getArrayCopy());
|
||||
|
||||
if ($mode === self::MODE_NETWORK) {
|
||||
$items = $this->addChildren($items, false, $order, $uid, $mode);
|
||||
$items = $this->addChildren($items, false, $order, $uid, $mode, $ignoredGsids);
|
||||
if (!$update) {
|
||||
/*
|
||||
* The special div is needed for liveUpdate to kick in for this page.
|
||||
|
@ -487,7 +498,7 @@ class Conversation
|
|||
. "'; </script>\r\n";
|
||||
}
|
||||
} elseif ($mode === self::MODE_PROFILE) {
|
||||
$items = $this->addChildren($items, false, $order, $uid, $mode);
|
||||
$items = $this->addChildren($items, false, $order, $uid, $mode, $ignoredGsids);
|
||||
|
||||
if (!$update) {
|
||||
$tab = !empty($_GET['tab']) ? trim($_GET['tab']) : 'posts';
|
||||
|
@ -512,7 +523,7 @@ class Conversation
|
|||
. "; var netargs = '?f='; </script>\r\n";
|
||||
}
|
||||
} elseif ($mode === self::MODE_DISPLAY) {
|
||||
$items = $this->addChildren($items, false, $order, $uid, $mode);
|
||||
$items = $this->addChildren($items, false, $order, $uid, $mode, $ignoredGsids);
|
||||
|
||||
if (!$update) {
|
||||
$live_update_div = '<div id="live-display"></div>' . "\r\n"
|
||||
|
@ -520,7 +531,7 @@ class Conversation
|
|||
. "</script>";
|
||||
}
|
||||
} elseif ($mode === self::MODE_COMMUNITY) {
|
||||
$items = $this->addChildren($items, true, $order, $uid, $mode);
|
||||
$items = $this->addChildren($items, true, $order, $uid, $mode, $ignoredGsids);
|
||||
|
||||
if (!$update) {
|
||||
$live_update_div = '<div id="live-community"></div>' . "\r\n"
|
||||
|
@ -531,7 +542,7 @@ class Conversation
|
|||
. "'; </script>\r\n";
|
||||
}
|
||||
} elseif ($mode === self::MODE_CONTACTS) {
|
||||
$items = $this->addChildren($items, false, $order, $uid, $mode);
|
||||
$items = $this->addChildren($items, false, $order, $uid, $mode, $ignoredGsids);
|
||||
|
||||
if (!$update) {
|
||||
$live_update_div = '<div id="live-contact"></div>' . "\r\n"
|
||||
|
@ -818,13 +829,14 @@ class Conversation
|
|||
*
|
||||
* @param array $parents Parent items
|
||||
* @param bool $block_authors
|
||||
* @param bool $order
|
||||
* @param string $order Either "received" or "commented"
|
||||
* @param int $uid
|
||||
* @param string $mode
|
||||
* @param string $mode One of self::MODE_*
|
||||
* @param array $ignoredGsids List of ids of servers ignored by the user
|
||||
* @return array items with parents and comments
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
private function addChildren(array $parents, bool $block_authors, string $order, int $uid, string $mode): array
|
||||
private function addChildren(array $parents, bool $block_authors, string $order, int $uid, string $mode, array $ignoredGsids = []): array
|
||||
{
|
||||
$this->profiler->startRecording('rendering');
|
||||
if (count($parents) > 1) {
|
||||
|
@ -906,6 +918,13 @@ class Conversation
|
|||
continue;
|
||||
}
|
||||
|
||||
if (in_array($row['author-gsid'], $ignoredGsids)
|
||||
|| in_array($row['owner-gsid'], $ignoredGsids)
|
||||
|| in_array($row['causer-gsid'], $ignoredGsids)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (($mode != self::MODE_CONTACTS) && !$row['origin']) {
|
||||
$row['featured'] = false;
|
||||
}
|
||||
|
@ -1468,6 +1487,7 @@ class Conversation
|
|||
'received' => $item['received'],
|
||||
'created_date' => $item['created'],
|
||||
'uriid' => $item['uri-id'],
|
||||
'author_gsid' => $item['author-gsid'],
|
||||
'network' => $item['network'],
|
||||
'network_name' => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network'], $item['author-gsid']),
|
||||
'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link'], $item['author-gsid']),
|
||||
|
|
|
@ -34,15 +34,16 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Attach;
|
||||
use Friendica\Model\Circle;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Model\FileTag;
|
||||
use Friendica\Model\Circle;
|
||||
use Friendica\Model\Item as ItemModel;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Object\EMail\ItemCCEMail;
|
||||
|
@ -54,6 +55,7 @@ use Friendica\Util\ParseUrl;
|
|||
use Friendica\Util\Profiler;
|
||||
use Friendica\Util\Proxy;
|
||||
use Friendica\Util\XML;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
|
||||
/**
|
||||
* A content helper class for displaying items
|
||||
|
@ -367,7 +369,7 @@ class Item
|
|||
{
|
||||
$this->profiler->startRecording('rendering');
|
||||
$sub_link = $contact_url = $pm_url = $status_link = '';
|
||||
$photos_link = $posts_link = $block_link = $ignore_link = '';
|
||||
$photos_link = $posts_link = $block_link = $ignore_link = $collapse_link = $ignoreserver_link = '';
|
||||
|
||||
if ($this->userSession->getLocalUserId() && $this->userSession->getLocalUserId() == $item['uid'] && $item['gravity'] == ItemModel::GRAVITY_PARENT && !$item['self'] && !$item['mention']) {
|
||||
$sub_link = 'javascript:doFollowThread(' . $item['id'] . '); return false;';
|
||||
|
@ -407,6 +409,11 @@ class Item
|
|||
$collapse_link = $item['self'] ? '' : $contact_url . '/collapse?t=' . $formSecurityToken;
|
||||
}
|
||||
|
||||
$authorBaseUri = new Uri($item['author-baseurl'] ?? '');
|
||||
if (!empty($item['author-gsid']) && $authorBaseUri->getHost() && !DI::baseUrl()->isLocalUrl($authorBaseUri)) {
|
||||
$ignoreserver_link = 'settings/server/' . $item['author-gsid'] . '/ignore';
|
||||
}
|
||||
|
||||
if ($cid && !$item['self']) {
|
||||
$contact_url = 'contact/' . $cid;
|
||||
$posts_link = $contact_url . '/posts';
|
||||
|
@ -427,7 +434,8 @@ class Item
|
|||
$this->l10n->t('Send PM') => $pm_url,
|
||||
$this->l10n->t('Block') => $block_link,
|
||||
$this->l10n->t('Ignore') => $ignore_link,
|
||||
$this->l10n->t('Collapse') => $collapse_link
|
||||
$this->l10n->t('Collapse') => $collapse_link,
|
||||
$this->l10n->t("Ignore %s server", $authorBaseUri->getHost()) => $ignoreserver_link,
|
||||
];
|
||||
|
||||
if (!empty($item['language'])) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue