From ba078b7b767c7eeda15b64c88022761c68738ddf Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Fri, 31 Dec 2021 17:40:37 +0000 Subject: [PATCH] [ENTITY][Note] Caching note replies query [COMPONENTS][Conversation] Reply route will now present a more suitable title --- src/Entity/Note.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Entity/Note.php b/src/Entity/Note.php index 4711f01f44..ad71ffef2f 100644 --- a/src/Entity/Note.php +++ b/src/Entity/Note.php @@ -34,8 +34,6 @@ use App\Util\Formatting; use Component\Avatar\Avatar; use Component\Conversation\Entity\Conversation; use Component\Language\Entity\Language; -use DateTimeInterface; -use function App\Core\I18n\_m; /** * Entity for notices @@ -354,7 +352,7 @@ class Note extends Entity */ public function getReplies(): array { - return DB::findBy('note', ['reply_to' => $this->getId()], order_by: ['created' => 'DESC', 'id' => 'DESC']); + return Cache::getList('note-replies-' . $this->getId(), fn () => DB::findBy('note', ['reply_to' => $this->getId()], order_by: ['created' => 'DESC', 'id' => 'DESC'])); } /**