From ba0b83b0b08498cb573c15f4a6b9661ef45957ed Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 15 Nov 2022 01:10:49 +0100 Subject: [PATCH] Make PHP-CS happy --- src/Module/Item/Display.php | 32 ++++++++++++++++++-------------- src/Module/Item/Feed.php | 4 ++-- src/Module/Update/Display.php | 12 +++++++----- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/Module/Item/Display.php b/src/Module/Item/Display.php index 7a0e589f82..1b54081d39 100644 --- a/src/Module/Item/Display.php +++ b/src/Module/Item/Display.php @@ -138,7 +138,8 @@ class Display extends BaseModule 'uid' => [0, $itemUid], 'uri-id' => $item['parent-uri-id'] ], ['order' => ['uid' => true]]); - $item = $parent ?: $item; + + $item = $parent ?: $item; } if (!$this->pConfig->get($this->session->getLocalUserId(), 'system', 'detailed_notif')) { @@ -224,12 +225,11 @@ class Display extends BaseModule $sql_extra = Item::getPermissionsSQLByUserId($pageUid); if ($this->session->getLocalUserId() && ($this->session->getLocalUserId() == $pageUid)) { - $condition = [ + $unseen = Post::exists([ 'parent-uri-id' => $item['parent-uri-id'], 'uid' => $this->session->getLocalUserId(), 'unseen' => true - ]; - $unseen = Post::exists($condition); + ]); } else { $unseen = false; } @@ -239,9 +239,12 @@ class Display extends BaseModule } $condition = ["`uri-id` = ? AND `uid` IN (0, ?) " . $sql_extra, $item['uri-id'], $itemUid]; - $fields = ['parent-uri-id', 'body', 'title', 'author-name', 'author-avatar', 'plink', 'author-id', - 'owner-id', 'contact-id']; - $item = Post::selectFirstForUser($pageUid, $fields, $condition); + $fields = [ + 'parent-uri-id', 'body', 'title', 'author-name', 'author-avatar', 'plink', 'author-id', + 'owner-id', 'contact-id' + ]; + + $item = Post::selectFirstForUser($pageUid, $fields, $condition); if (empty($item)) { throw new HTTPException\NotFoundException($this->t('The requested item doesn\'t exist or has been deleted.')); @@ -277,11 +280,10 @@ class Display extends BaseModule { if (Post::exists(['uri-id' => $uriId, 'private' => [Item::PUBLIC, Item::UNLISTED]])) { // For the atom feed the nickname doesn't matter at all, we only need the item id. - $alternate = sprintf('display/feed-item/%s.atom', $uriId); - $conversation = sprintf('display/feed-item/%s/conversation.atom', $parentUriId); - $this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('display-head.tpl'), - ['$alternate' => $alternate, - '$conversation' => $conversation]); + $this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('display-head.tpl'), [ + '$alternate' => sprintf('display/feed-item/%s.atom', $uriId), + '$conversation' => sprintf('display/feed-item/%s/conversation.atom', $parentUriId) + ]); } } @@ -317,8 +319,10 @@ class Display extends BaseModule $page = $this->page; - if (Contact::exists(['unsearchable' => true, - 'id' => [$item['contact-id'], $item['author-id'], $item['owner-id']]])) { + if (Contact::exists([ + 'unsearchable' => true, + 'id' => [$item['contact-id'], $item['author-id'], $item['owner-id']] + ])) { $page['htmlhead'] .= "\n"; } diff --git a/src/Module/Item/Feed.php b/src/Module/Item/Feed.php index 8830cb0afa..c1b12446c8 100644 --- a/src/Module/Item/Feed.php +++ b/src/Module/Item/Feed.php @@ -72,9 +72,9 @@ class Feed extends BaseModule 'guid', 'gravity', ], [ - 'uri-id' => $uriId, + 'uri-id' => $uriId, 'private' => [Item::PUBLIC, Item::UNLISTED], - 'uid' => 0, + 'uid' => 0, ]); if (empty($item)) { diff --git a/src/Module/Update/Display.php b/src/Module/Update/Display.php index a8dea82e1c..9467badf32 100644 --- a/src/Module/Update/Display.php +++ b/src/Module/Update/Display.php @@ -38,9 +38,9 @@ class Display extends DisplayModule throw new HTTPException\UnauthorizedException($this->t('Access denied.')); } - $profileUid = $request['p'] ?? 0; - $force = $request['force'] ?? false; - $uriId = $request['uri_id'] ?? 0; + $profileUid = $request['p'] ?? 0; + $force = $request['force'] ?? false; + $uriId = $request['uri_id'] ?? 0; if (empty($uriId)) { throw new HTTPException\BadRequestException($this->t('Parameter uri_id is missing.')); @@ -63,8 +63,10 @@ class Display extends DisplayModule $browserUpdate = $this->pConfig->get($profileUid, 'system', 'update_interval'); if (!empty($browserUpdate)) { $updateDate = date(DateTimeFormat::MYSQL, time() - (intval($browserUpdate) / 500)); - if (!Post::exists(["`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parentUriId, 0, - $profileUid, $updateDate])) { + if (!Post::exists([ + "`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", + $parentUriId, 0, + $profileUid, $updateDate])) { $this->logger->debug('No updated content. Ending process', ['uri-id' => $uriId, 'uid' => $profileUid, 'updated' => $updateDate]); return ''; -- 2.39.5