From 9396539f5811ba0d09ca010ac62fcaf938014d1d Mon Sep 17 00:00:00 2001 From: Alexei Sorokin Date: Wed, 8 Apr 2020 15:25:30 +0300 Subject: [PATCH] [CORE] Re-format the inboxnoticestream query --- lib/notices/inboxnoticestream.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/notices/inboxnoticestream.php b/lib/notices/inboxnoticestream.php index 4083ef247c..a261da5495 100644 --- a/lib/notices/inboxnoticestream.php +++ b/lib/notices/inboxnoticestream.php @@ -92,12 +92,20 @@ class RawInboxNoticeStream extends FullNoticeStream // Reply:: is a table of mentions // Subscription:: is a table of subscriptions (every user is subscribed to themselves) $notice->_join .= sprintf( - "\n" . 'NATURAL INNER JOIN (' . - '(SELECT id FROM notice WHERE profile_id IN (SELECT subscribed FROM subscription WHERE subscriber = %1$d)) ' . - 'UNION (SELECT notice_id AS id FROM reply WHERE profile_id = %1$d) ' . - 'UNION (SELECT notice_id AS id FROM attention WHERE profile_id = %1$d) ' . - 'UNION (SELECT notice_id AS id FROM group_inbox WHERE group_id IN (SELECT group_id FROM group_member WHERE profile_id = %1$d))' . - ') AS t1', + "\n" . <<<'END' + INNER JOIN ( + (SELECT id FROM notice + WHERE profile_id + IN (SELECT subscribed FROM subscription WHERE subscriber = %1$d)) + UNION + (SELECT notice_id AS id FROM reply WHERE profile_id = %1$d) + UNION + (SELECT notice_id AS id FROM attention WHERE profile_id = %1$d) + UNION + (SELECT notice_id AS id FROM group_inbox INNER JOIN group_member USING (group_id) + WHERE group_member.profile_id = %1$d) + ) AS t1 USING (id) + END, $this->target->getID() );