diff --git a/database.sql b/database.sql index b033d40b5f..5522b574bb 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2021.03-rc (Red Hot Poker) --- DB_UPDATE_VERSION 1409 +-- DB_UPDATE_VERSION 1410 -- ------------------------------------------ @@ -1132,6 +1132,7 @@ CREATE TABLE IF NOT EXISTS `post-user` ( INDEX `uid_contactid` (`uid`,`contact-id`), INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`), INDEX `uid_unseen` (`uid`,`unseen`), + INDEX `uid_hidden_uri-id` (`uid`,`hidden`,`uri-id`), FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE, FOREIGN KEY (`parent-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE, FOREIGN KEY (`thr-parent-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE, diff --git a/src/Model/Post.php b/src/Model/Post.php index 4adc5728dd..3727d29a36 100644 --- a/src/Model/Post.php +++ b/src/Model/Post.php @@ -313,7 +313,7 @@ class Post AND (NOT `causer-blocked` OR `causer-id` = ? OR `causer-id` IS NULL) AND NOT `contact-blocked` AND ((NOT `contact-readonly` AND NOT `contact-pending` AND (`contact-rel` IN (?, ?))) OR `self` OR `gravity` != ? OR `contact-uid` = ?) - AND NOT EXISTS (SELECT `uri-id` FROM `post-user` USE INDEX (`uid_uri-id`) WHERE `uid` = ? AND `uri-id` = `" . $view . "`.`uri-id` AND `hidden`) + AND NOT EXISTS (SELECT `uri-id` FROM `post-user` WHERE `uid` = ? AND `uri-id` = `" . $view . "`.`uri-id` AND `hidden`) AND NOT EXISTS (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `author-id` AND `blocked`) AND NOT EXISTS (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `owner-id` AND `blocked`) AND NOT EXISTS (SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `author-id` AND `ignored` AND `gravity` = ?) diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 91356a018d..a95c1d8938 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -55,7 +55,7 @@ use Friendica\Database\DBA; if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1409); + define('DB_UPDATE_VERSION', 1410); } return [ @@ -1184,6 +1184,7 @@ return [ "uid_contactid" => ["uid", "contact-id"], "uid_unseen_contactid" => ["uid", "unseen", "contact-id"], "uid_unseen" => ["uid", "unseen"], + "uid_hidden_uri-id" => ["uid", "hidden", "uri-id"], ], ], "post-thread-user" => [