From 04f43a9d37a5197b22916b4493df56e8e567255e Mon Sep 17 00:00:00 2001 From: rainydaysavings Date: Sat, 29 Aug 2020 06:21:04 +0100 Subject: [PATCH] [Controller] Attempting to fix home timeline query --- src/Controller/Network.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Controller/Network.php b/src/Controller/Network.php index 3ce9271a90..a273399973 100644 --- a/src/Controller/Network.php +++ b/src/Controller/Network.php @@ -47,7 +47,32 @@ class Network extends Controller public function home(Request $request) { - $notes = DB::findBy('note', [], ['created' => 'DESC']); + $notes = DB::dql( + 'select n from ( + ( + select note.id + from App\Entity\Note + inner join App\Entity\Follow + with note.id = follow.followed + ) + union all + ( + select note.id + from App\Entity\Note + with note.id = note.reply_to + ) + union all + ( + select note.id + from App\Entity\Note + inner join App\Entity\GroupInbox + with note.id = group_inbox.activity_id + inner join App\Entity\GroupMember + where group_inbox.group_id = group_member.group_id + ) + ) n ' . + 'order by n.created DESC' + ); return [ '_template' => 'network/public.html.twig', 'notes' => $notes,