use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Item as ItemModel;
-use Friendica\Model\Photo;
use Friendica\Model\Post;
use Friendica\Model\Tag;
use Friendica\Model\User;
use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Profiler;
-use Friendica\Util\Proxy;
use Friendica\Util\Strings;
use Friendica\Util\Temporal;
use Psr\Log\LoggerInterface;
}
// Skip when the causer of the parent is the same as the author of the announce
- if (($verb == Activity::ANNOUNCE) && !empty($thread_parent['causer-id'] && ($thread_parent['causer-id'] == $activity['author-id']))) {
+ if (($verb == Activity::ANNOUNCE) && !empty($thread_parent['causer-id']) && ($thread_parent['causer-id'] == $activity['author-id'])) {
continue;
}
* @return string formatted text
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function formatActivity(array $links, $verb, $id)
+ public function formatActivity(array $links, string $verb, int $id): string
{
$this->profiler->startRecording('rendering');
$o = '';
return $o;
}
- public function statusEditor(array $x = [], $notes_cid = 0, $popup = false)
+ public function statusEditor(array $x = [], int $notes_cid = 0, bool $popup = false): string
{
$user = User::getById($this->app->getLoggedInUserId(), ['uid', 'nickname', 'allow_location', 'default-location']);
if (empty($user['uid'])) {
* figures out how to determine page owner and other contextual items
* that are based on unique features of the calling module.
* @param array $items
- * @param $mode
- * @param $update
+ * @param string $mode
+ * @param $update @TODO Which type?
* @param bool $preview
* @param string $order
* @param int $uid
* @throws ImagickException
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function create(array $items, $mode, $update, $preview = false, $order = 'commented', $uid = 0)
+ public function create(array $items, string $mode, $update, bool $preview = false, string $order = 'commented', int $uid = 0): string
{
$this->profiler->startRecording('rendering');
. "<script> var profile_uid = -1; var netargs = '" . substr($this->args->getCommand(), 10)
. '?f='
. (!empty($_GET['no_sharer']) ? '&no_sharer=' . rawurlencode($_GET['no_sharer']) : '')
+ . (!empty($_GET['accounttype']) ? '&accounttype=' . rawurlencode($_GET['accounttype']) : '')
. "'; </script>\r\n";
}
} elseif ($mode === 'contacts') {
if (in_array($mode, ['community', 'contacts', 'profile'])) {
$writable = true;
} else {
- $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], Protocol::FEDERATED);
+ $writable = $items[0]['writable'] || ($items[0]['uid'] == 0) && in_array($items[0]['network'], Protocol::FEDERATED);
}
if (!local_user()) {
$uriids[] = $item['uri-id'];
- if (!$this->item->visibleActivity($item)) {
+ if (!$this->item->isVisibleActivity($item)) {
continue;
}
continue;
}
- if (!$this->item->visibleActivity($item)) {
+ if (!$this->item->isVisibleActivity($item)) {
continue;
}
return $o;
}
- private function getBlocklist()
+ private function getBlocklist(): array
{
if (!local_user()) {
return [];
*
* @return array items with parents and comments
*/
- private function addRowInformation(array $row, array $activity, array $thr_parent)
+ private function addRowInformation(array $row, array $activity, array $thr_parent): array
{
$this->profiler->startRecording('rendering');
- if ($row['uid'] == 0) {
+ if (!$row['writable']) {
$row['writable'] = in_array($row['network'], Protocol::FEDERATED);
}
$row['direction'] = ['direction' => 7, 'title' => $this->l10n->t('You had been addressed (%s).', 'bcc')];
break;
case ItemModel::PR_FOLLOWER:
- $row['direction'] = ['direction' => 6, 'title' => $this->l10n->t('You are following %s.', $row['author-name'])];
+ $row['direction'] = ['direction' => 6, 'title' => $this->l10n->t('You are following %s.', $row['causer-name'] ?: $row['author-name'])];
break;
case ItemModel::PR_TAG:
- $row['direction'] = ['direction' => 4, 'title' => $this->l10n->t('Tagged')];
+ $row['direction'] = ['direction' => 4, 'title' => $this->l10n->t('You subscribed to one or more tags in this post.')];
break;
case ItemModel::PR_ANNOUNCEMENT:
if (!empty($row['causer-id']) && $this->pConfig->get(local_user(), 'system', 'display_resharer')) {
$row['direction'] = ['direction' => 5, 'title' => $this->l10n->t('%s is participating in this thread.', $row['author-name'])];
break;
case ItemModel::PR_STORED:
- $row['direction'] = ['direction' => 8, 'title' => $this->l10n->t('Stored')];
+ $row['direction'] = ['direction' => 8, 'title' => $this->l10n->t('Stored for general reasons')];
break;
case ItemModel::PR_GLOBAL:
- $row['direction'] = ['direction' => 9, 'title' => $this->l10n->t('Global')];
+ $row['direction'] = ['direction' => 9, 'title' => $this->l10n->t('Global post')];
break;
case ItemModel::PR_RELAY:
- $row['direction'] = ['direction' => 10, 'title' => (empty($row['causer-id']) ? $this->l10n->t('Relayed') : $this->l10n->t('Relayed by %s <%s>', $row['causer-name'], $row['causer-link']))];
+ $row['direction'] = ['direction' => 10, 'title' => (empty($row['causer-id']) ? $this->l10n->t('Sent via an relay server') : $this->l10n->t('Sent via the relay server %s <%s>', $row['causer-name'], $row['causer-link']))];
break;
case ItemModel::PR_FETCHED:
$row['direction'] = ['direction' => 2, 'title' => (empty($row['causer-id']) ? $this->l10n->t('Fetched') : $this->l10n->t('Fetched because of %s <%s>', $row['causer-name'], $row['causer-link']))];
break;
+ case ItemModel::PR_COMPLETION:
+ $row['direction'] = ['direction' => 2, 'title' => $this->l10n->t('Stored because of a child post to complete this thread.')];
+ break;
+ case ItemModel::PR_DIRECT:
+ $row['direction'] = ['direction' => 6, 'title' => $this->l10n->t('Local delivery')];
+ break;
+ case ItemModel::PR_ACTIVITY:
+ $row['direction'] = ['direction' => 2, 'title' => $this->l10n->t('Stored because of your activity (like, comment, star, ...)')];
+ break;
+ case ItemModel::PR_DISTRIBUTE:
+ $row['direction'] = ['direction' => 6, 'title' => $this->l10n->t('Distributed')];
+ break;
+ case ItemModel::PR_PUSHED:
+ $row['direction'] = ['direction' => 1, 'title' => $this->l10n->t('Pushed to us')];
+ break;
}
$row['thr-parent-row'] = $thr_parent;
* @return array items with parents and comments
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- private function addChildren(array $parents, bool $block_authors, string $order, int $uid, string $mode)
+ private function addChildren(array $parents, bool $block_authors, string $order, int $uid, string $mode): array
{
$this->profiler->startRecording('rendering');
if (count($parents) > 1) {
* @param bool $recursive
* @return array
*/
- private function getItemChildren(array &$item_list, array $parent, $recursive = true)
+ private function getItemChildren(array &$item_list, array $parent, bool $recursive = true): array
{
$this->profiler->startRecording('rendering');
$children = [];
* @param array $items
* @return array
*/
- private function sortItemChildren(array $items)
+ private function sortItemChildren(array $items): array
{
$this->profiler->startRecording('rendering');
$result = $items;
* @param array $parent A tree-like array of items
* @return array
*/
- private function smartFlattenConversation(array $parent)
+ private function smartFlattenConversation(array $parent): array
{
$this->profiler->startRecording('rendering');
if (!isset($parent['children']) || count($parent['children']) == 0) {
* @return array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- private function convSort(array $item_list, $order)
+ private function convSort(array $item_list, string $order): array
{
$this->profiler->startRecording('rendering');
$parents = [];
* @param array $b
* @return int
*/
- private function sortThrFeaturedReceived(array $a, array $b)
+ private function sortThrFeaturedReceived(array $a, array $b): int
{
if ($b['featured'] && !$a['featured']) {
return 1;
* @param array $b
* @return int
*/
- private function sortThrFeaturedCommented(array $a, array $b)
+ private function sortThrFeaturedCommented(array $a, array $b): int
{
if ($b['featured'] && !$a['featured']) {
return 1;
* @param array $b
* @return int
*/
- private function sortThrReceived(array $a, array $b)
+ private function sortThrReceived(array $a, array $b): int
{
return strcmp($b['received'], $a['received']);
}
* @param array $b
* @return int
*/
- private function sortThrReceivedRev(array $a, array $b)
+ private function sortThrReceivedRev(array $a, array $b): int
{
return strcmp($a['received'], $b['received']);
}
* @param array $b
* @return int
*/
- private function sortThrCommented(array $a, array $b)
+ private function sortThrCommented(array $a, array $b): int
{
return strcmp($b['commented'], $a['commented']);
}
* @param array $b
* @return int
*/
- private function sortThrCreated(array $a, array $b)
+ private function sortThrCreated(array $a, array $b): int
{
return strcmp($b['created'], $a['created']);
}