mirror of
https://github.com/friendica/friendica
synced 2024-12-22 18:00:16 +00:00
[Database 1527] Add required gsid fields to post-user-view, post-thread-user-view, post-view and post-thread-view
This commit is contained in:
parent
a670d478f8
commit
156e3fa101
3 changed files with 26 additions and 6 deletions
16
database.sql
16
database.sql
|
@ -1,6 +1,6 @@
|
|||
-- ------------------------------------------
|
||||
-- Friendica 2023.09-dev (Giant Rhubarb)
|
||||
-- DB_UPDATE_VERSION 1526
|
||||
-- DB_UPDATE_VERSION 1527
|
||||
-- ------------------------------------------
|
||||
|
||||
|
||||
|
@ -2056,6 +2056,7 @@ CREATE VIEW `post-user-view` AS SELECT
|
|||
`owner`.`blocked` AS `owner-blocked`,
|
||||
`owner`.`hidden` AS `owner-hidden`,
|
||||
`owner`.`updated` AS `owner-updated`,
|
||||
`owner`.`gsid` AS `owner-gsid`,
|
||||
`owner`.`contact-type` AS `owner-contact-type`,
|
||||
`post-user`.`causer-id` AS `causer-id`,
|
||||
`causer`.`uri-id` AS `causer-uri-id`,
|
||||
|
@ -2068,6 +2069,7 @@ CREATE VIEW `post-user-view` AS SELECT
|
|||
`causer`.`network` AS `causer-network`,
|
||||
`causer`.`blocked` AS `causer-blocked`,
|
||||
`causer`.`hidden` AS `causer-hidden`,
|
||||
`causer`.`gsid` AS `causer-gsid`,
|
||||
`causer`.`contact-type` AS `causer-contact-type`,
|
||||
`post-delivery-data`.`postopts` AS `postopts`,
|
||||
`post-delivery-data`.`inform` AS `inform`,
|
||||
|
@ -2201,6 +2203,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
|
|||
`contact`.`pending` AS `contact-pending`,
|
||||
`contact`.`rel` AS `contact-rel`,
|
||||
`contact`.`uid` AS `contact-uid`,
|
||||
`contact`.`gsid` AS `contact-gsid`,
|
||||
`contact`.`contact-type` AS `contact-contact-type`,
|
||||
IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`) AS `writable`,
|
||||
`contact`.`self` AS `self`,
|
||||
|
@ -2236,6 +2239,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
|
|||
`owner`.`blocked` AS `owner-blocked`,
|
||||
`owner`.`hidden` AS `owner-hidden`,
|
||||
`owner`.`updated` AS `owner-updated`,
|
||||
`owner`.`gsid` AS `owner-gsid`,
|
||||
`owner`.`contact-type` AS `owner-contact-type`,
|
||||
`post-thread-user`.`causer-id` AS `causer-id`,
|
||||
`causer`.`uri-id` AS `causer-uri-id`,
|
||||
|
@ -2248,6 +2252,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
|
|||
`causer`.`network` AS `causer-network`,
|
||||
`causer`.`blocked` AS `causer-blocked`,
|
||||
`causer`.`hidden` AS `causer-hidden`,
|
||||
`causer`.`gsid` AS `causer-gsid`,
|
||||
`causer`.`contact-type` AS `causer-contact-type`,
|
||||
`post-delivery-data`.`postopts` AS `postopts`,
|
||||
`post-delivery-data`.`inform` AS `inform`,
|
||||
|
@ -2403,6 +2408,7 @@ CREATE VIEW `post-view` AS SELECT
|
|||
`owner`.`hidden` AS `owner-hidden`,
|
||||
`owner`.`updated` AS `owner-updated`,
|
||||
`owner`.`contact-type` AS `owner-contact-type`,
|
||||
`owner`.`gsid` AS `owner-gsid`,
|
||||
`post`.`causer-id` AS `causer-id`,
|
||||
`causer`.`uri-id` AS `causer-uri-id`,
|
||||
`causer`.`url` AS `causer-link`,
|
||||
|
@ -2415,6 +2421,7 @@ CREATE VIEW `post-view` AS SELECT
|
|||
`causer`.`blocked` AS `causer-blocked`,
|
||||
`causer`.`hidden` AS `causer-hidden`,
|
||||
`causer`.`contact-type` AS `causer-contact-type`,
|
||||
`causer`.`gsid` AS `causer-gsid`,
|
||||
`post-question`.`id` AS `question-id`,
|
||||
`post-question`.`multiple` AS `question-multiple`,
|
||||
`post-question`.`voters` AS `question-voters`,
|
||||
|
@ -2545,6 +2552,7 @@ CREATE VIEW `post-thread-view` AS SELECT
|
|||
`owner`.`blocked` AS `owner-blocked`,
|
||||
`owner`.`hidden` AS `owner-hidden`,
|
||||
`owner`.`updated` AS `owner-updated`,
|
||||
`owner`.`gsid` AS `owner-gsid`,
|
||||
`owner`.`contact-type` AS `owner-contact-type`,
|
||||
`post-thread`.`causer-id` AS `causer-id`,
|
||||
`causer`.`uri-id` AS `causer-uri-id`,
|
||||
|
@ -2557,6 +2565,7 @@ CREATE VIEW `post-thread-view` AS SELECT
|
|||
`causer`.`network` AS `causer-network`,
|
||||
`causer`.`blocked` AS `causer-blocked`,
|
||||
`causer`.`hidden` AS `causer-hidden`,
|
||||
`causer`.`gsid` AS `causer-gsid`,
|
||||
`causer`.`contact-type` AS `causer-contact-type`,
|
||||
`post-question`.`id` AS `question-id`,
|
||||
`post-question`.`multiple` AS `question-multiple`,
|
||||
|
@ -2678,7 +2687,7 @@ CREATE VIEW `network-item-view` AS SELECT
|
|||
`post-user`.`contact-id` AS `contact-id`,
|
||||
`ownercontact`.`contact-type` AS `contact-type`
|
||||
FROM `post-user`
|
||||
INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
|
||||
INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
|
||||
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
|
||||
STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
|
||||
STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
|
||||
|
@ -2719,7 +2728,8 @@ CREATE VIEW `network-thread-view` AS SELECT
|
|||
AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
|
||||
AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
|
||||
AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
|
||||
AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`);
|
||||
AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)
|
||||
AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`);
|
||||
|
||||
--
|
||||
-- VIEW owner-view
|
||||
|
|
|
@ -56,7 +56,7 @@ use Friendica\Database\DBA;
|
|||
|
||||
// This file is required several times during the test in DbaDefinition which justifies this condition
|
||||
if (!defined('DB_UPDATE_VERSION')) {
|
||||
define('DB_UPDATE_VERSION', 1526);
|
||||
define('DB_UPDATE_VERSION', 1527);
|
||||
}
|
||||
|
||||
return [
|
||||
|
|
|
@ -197,6 +197,7 @@
|
|||
"owner-blocked" => ["owner", "blocked"],
|
||||
"owner-hidden" => ["owner", "hidden"],
|
||||
"owner-updated" => ["owner", "updated"],
|
||||
"owner-gsid" => ["owner", "gsid"],
|
||||
"owner-contact-type" => ["owner", "contact-type"],
|
||||
"causer-id" => ["post-user", "causer-id"],
|
||||
"causer-uri-id" => ["causer", "uri-id"],
|
||||
|
@ -209,6 +210,7 @@
|
|||
"causer-network" => ["causer", "network"],
|
||||
"causer-blocked" => ["causer", "blocked"],
|
||||
"causer-hidden" => ["causer", "hidden"],
|
||||
"causer-gsid" => ["causer", "gsid"],
|
||||
"causer-contact-type" => ["causer", "contact-type"],
|
||||
"postopts" => ["post-delivery-data", "postopts"],
|
||||
"inform" => ["post-delivery-data", "inform"],
|
||||
|
@ -340,6 +342,7 @@
|
|||
"contact-pending" => ["contact", "pending"],
|
||||
"contact-rel" => ["contact", "rel"],
|
||||
"contact-uid" => ["contact", "uid"],
|
||||
"contact-gsid" => ["contact", "gsid"],
|
||||
"contact-contact-type" => ["contact", "contact-type"],
|
||||
"writable" => "IF (`post-user`.`network` IN ('apub', 'dfrn', 'dspr', 'stat'), true, `contact`.`writable`)",
|
||||
"self" => ["contact", "self"],
|
||||
|
@ -375,6 +378,7 @@
|
|||
"owner-blocked" => ["owner", "blocked"],
|
||||
"owner-hidden" => ["owner", "hidden"],
|
||||
"owner-updated" => ["owner", "updated"],
|
||||
"owner-gsid" => ["owner", "gsid"],
|
||||
"owner-contact-type" => ["owner", "contact-type"],
|
||||
"causer-id" => ["post-thread-user", "causer-id"],
|
||||
"causer-uri-id" => ["causer", "uri-id"],
|
||||
|
@ -387,6 +391,7 @@
|
|||
"causer-network" => ["causer", "network"],
|
||||
"causer-blocked" => ["causer", "blocked"],
|
||||
"causer-hidden" => ["causer", "hidden"],
|
||||
"causer-gsid" => ["causer", "gsid"],
|
||||
"causer-contact-type" => ["causer", "contact-type"],
|
||||
"postopts" => ["post-delivery-data", "postopts"],
|
||||
"inform" => ["post-delivery-data", "inform"],
|
||||
|
@ -540,6 +545,7 @@
|
|||
"owner-hidden" => ["owner", "hidden"],
|
||||
"owner-updated" => ["owner", "updated"],
|
||||
"owner-contact-type" => ["owner", "contact-type"],
|
||||
"owner-gsid" => ["owner", "gsid"],
|
||||
"causer-id" => ["post", "causer-id"],
|
||||
"causer-uri-id" => ["causer", "uri-id"],
|
||||
"causer-link" => ["causer", "url"],
|
||||
|
@ -552,6 +558,7 @@
|
|||
"causer-blocked" => ["causer", "blocked"],
|
||||
"causer-hidden" => ["causer", "hidden"],
|
||||
"causer-contact-type" => ["causer", "contact-type"],
|
||||
"causer-gsid" => ["causer", "gsid"],
|
||||
"question-id" => ["post-question", "id"],
|
||||
"question-multiple" => ["post-question", "multiple"],
|
||||
"question-voters" => ["post-question", "voters"],
|
||||
|
@ -680,6 +687,7 @@
|
|||
"owner-blocked" => ["owner", "blocked"],
|
||||
"owner-hidden" => ["owner", "hidden"],
|
||||
"owner-updated" => ["owner", "updated"],
|
||||
"owner-gsid" => ["owner", "gsid"],
|
||||
"owner-contact-type" => ["owner", "contact-type"],
|
||||
"causer-id" => ["post-thread", "causer-id"],
|
||||
"causer-uri-id" => ["causer", "uri-id"],
|
||||
|
@ -692,6 +700,7 @@
|
|||
"causer-network" => ["causer", "network"],
|
||||
"causer-blocked" => ["causer", "blocked"],
|
||||
"causer-hidden" => ["causer", "hidden"],
|
||||
"causer-gsid" => ["causer", "gsid"],
|
||||
"causer-contact-type" => ["causer", "contact-type"],
|
||||
"question-id" => ["post-question", "id"],
|
||||
"question-multiple" => ["post-question", "multiple"],
|
||||
|
@ -804,7 +813,7 @@
|
|||
"contact-type" => ["ownercontact", "contact-type"],
|
||||
],
|
||||
"query" => "FROM `post-user`
|
||||
INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
|
||||
INNER JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
|
||||
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-thread-user`.`contact-id`
|
||||
STRAIGHT_JOIN `contact` AS `authorcontact` ON `authorcontact`.`id` = `post-thread-user`.`author-id`
|
||||
STRAIGHT_JOIN `contact` AS `ownercontact` ON `ownercontact`.`id` = `post-thread-user`.`owner-id`
|
||||
|
@ -843,7 +852,8 @@
|
|||
AND (`post-thread-user`.`hidden` IS NULL OR NOT `post-thread-user`.`hidden`)
|
||||
AND NOT `authorcontact`.`blocked` AND NOT `ownercontact`.`blocked`
|
||||
AND (`author`.`blocked` IS NULL OR NOT `author`.`blocked`)
|
||||
AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)"
|
||||
AND (`owner`.`blocked` IS NULL OR NOT `owner`.`blocked`)
|
||||
AND NOT EXISTS(SELECT `gsid` FROM `user-gserver` WHERE `uid` = `post-thread-user`.`uid` AND `gsid` IN (`authorcontact`.`gsid`, `ownercontact`.`gsid`) AND `ignored`)"
|
||||
],
|
||||
"owner-view" => [
|
||||
"fields" => [
|
||||
|
|
Loading…
Reference in a new issue