[Controller] Attempting to fix home timeline query

This commit is contained in:
rainydaysavings 2020-08-29 06:21:04 +01:00 committed by Hugo Sales
parent ecdd393c8e
commit 04f43a9d37
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -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,