]> git.mxchange.org Git - friendica.git/commitdiff
[Database 1527] Add required gsid fields to post-user-view, post-thread-user-view...
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 18 Jul 2023 01:29:45 +0000 (21:29 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 20 Aug 2023 18:27:40 +0000 (14:27 -0400)
database.sql
static/dbstructure.config.php
static/dbview.config.php

index a6dc45dac41ca3bf71691b7bd9e270737afcc94d..b0f3ca7962a4c5cfe98f03d392b5a2d0c83d4980 100644 (file)
@@ -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
index 82b84e8a6122005ad6aa592cab0b8ee109125a8e..dcda833aaf6e12b6813a41860ae75e9ccffe0ac8 100644 (file)
@@ -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 [
index e8641240c2c2de4653ea2b6f79877d4fe03d7ea5..5da17a42e70aa22b5c41acedc994ac4205d6b254 100644 (file)
                        "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"],
                        "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"],
                        "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"],
                        "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"],
                        "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"],
                        "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"],
                        "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"],
                        "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"],
                        "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"],
                        "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`
                        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" => [