]> git.mxchange.org Git - friendica.git/commitdiff
Don't display Peertube groups as forums
authorMichael <heluecht@pirati.ca>
Thu, 24 Mar 2022 11:29:50 +0000 (11:29 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 24 Mar 2022 11:29:50 +0000 (11:29 +0000)
database.sql
src/Content/ForumManager.php
static/dbstructure.config.php
static/dbview.config.php

index 39e40c044a5286c726e2cad49c0439c4a6135fd6..ffe020203319fba875772d6cae57ea771e6c060c 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2022.05-dev (Siberian Iris)
--- DB_UPDATE_VERSION 1452
+-- DB_UPDATE_VERSION 1453
 -- ------------------------------------------
 
 
@@ -2412,10 +2412,8 @@ CREATE VIEW `account-view` AS SELECT
        `contact`.`archive` AS `archive`,
        `contact`.`deleted` AS `deleted`,
        `contact`.`blocked` AS `blocked`,
-       `contact`.`request` AS `dfrn-request`,
        `contact`.`notify` AS `dfrn-notify`,
        `contact`.`poll` AS `dfrn-poll`,
-       `contact`.`confirm` AS `dfrn-confirm`,
        `fcontact`.`guid` AS `diaspora-guid`,
        `fcontact`.`batch` AS `diaspora-batch`,
        `fcontact`.`notify` AS `diaspora-notify`,
@@ -2431,11 +2429,15 @@ CREATE VIEW `account-view` AS SELECT
        `apcontact`.`generator` AS `ap-generator`,
        `apcontact`.`following_count` AS `ap-following_count`,
        `apcontact`.`followers_count` AS `ap-followers_count`,
-       `apcontact`.`statuses_count` AS `ap-statuses_count`
+       `apcontact`.`statuses_count` AS `ap-statuses_count`,
+       `gserver`.`site_name` AS `site_name`,
+       `gserver`.`platform` AS `platform`,
+       `gserver`.`version` AS `version`
        FROM `contact`
                        LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
                        LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `contact`.`uri-id`
                        LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = contact.`uri-id`
+                       LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`
                        WHERE `contact`.`uid` = 0;
 
 --
@@ -2511,10 +2513,8 @@ CREATE VIEW `account-user-view` AS SELECT
        `ucontact`.`subhub` AS `subhub`,
        `ucontact`.`hub-verify` AS `hub-verify`,
        `ucontact`.`reason` AS `reason`,
-       `contact`.`request` AS `dfrn-request`,
        `contact`.`notify` AS `dfrn-notify`,
        `contact`.`poll` AS `dfrn-poll`,
-       `contact`.`confirm` AS `dfrn-confirm`,
        `fcontact`.`guid` AS `diaspora-guid`,
        `fcontact`.`batch` AS `diaspora-batch`,
        `fcontact`.`notify` AS `diaspora-notify`,
@@ -2530,12 +2530,16 @@ CREATE VIEW `account-user-view` AS SELECT
        `apcontact`.`generator` AS `ap-generator`,
        `apcontact`.`following_count` AS `ap-following_count`,
        `apcontact`.`followers_count` AS `ap-followers_count`,
-       `apcontact`.`statuses_count` AS `ap-statuses_count`
+       `apcontact`.`statuses_count` AS `ap-statuses_count`,
+       `gserver`.`site_name` AS `site_name`,
+       `gserver`.`platform` AS `platform`,
+       `gserver`.`version` AS `version`
        FROM `contact` AS `ucontact`
                        INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0
                        LEFT JOIN `item-uri` ON `item-uri`.`id` = `ucontact`.`uri-id`
                        LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `ucontact`.`uri-id`
-                       LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = `ucontact`.`uri-id` AND `fcontact`.`network` = 'dspr';
+                       LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = `ucontact`.`uri-id` AND `fcontact`.`network` = 'dspr'
+                       LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`;
 
 --
 -- VIEW pending-view
index 0104d388f59f9b557900d0919face9e4dbcb7c7a..51abaa49ddca3ee3811db420069882ee18620168 100644 (file)
@@ -57,23 +57,29 @@ class ForumManager
                        $params = ['order' => ['name']];
                }
 
-               $condition_str = "`network` IN (?, ?) AND `uid` = ? AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND ";
-
-               if ($showprivate) {
-                       $condition_str .= '(`forum` OR `prv`)';
-               } else {
-                       $condition_str .= '`forum`';
+               $condition = [
+                       'contact-type' => Contact::TYPE_COMMUNITY,
+                       'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB],
+                       'uid' => $uid, 
+                       'blocked' => false,
+                       'pending' => false,
+                       'archive' => false, 
+               ];
+
+               $condition = DBA::mergeConditions($condition, ["`platform` != ?", 'peertube']);
+
+               if (!$showprivate) {
+                       $condition = DBA::mergeConditions($condition, ['manually-approve' => false]);
                }
 
                if (!$showhidden) {
-                       $condition_str .=  ' AND NOT `hidden`';
+                       $condition = DBA::mergeConditions($condition, ['hidden' => false]);
                }
 
                $forumlist = [];
 
                $fields = ['id', 'url', 'name', 'micro', 'thumb', 'avatar', 'network', 'uid'];
-               $condition = [$condition_str, Protocol::DFRN, Protocol::ACTIVITYPUB, $uid];
-               $contacts = DBA::select('contact', $fields, $condition, $params);
+               $contacts = DBA::select('account-user-view', $fields, $condition, $params);
                if (!$contacts) {
                        return($forumlist);
                }
index 8963b1df604e5215f64daa56e9eee3658f948ec2..fd1e39cc2e124e67a9ea273e6512e888d31916be 100644 (file)
@@ -55,7 +55,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1452);
+       define('DB_UPDATE_VERSION', 1453);
 }
 
 return [
index 014973de2640b95a928d67d5842751756596f534..a5c52c9b1343b36f47cc1ffb6a0794ac8c6beeb3 100644 (file)
                        "archive" => ["contact", "archive"],
                        "deleted" => ["contact", "deleted"],
                        "blocked" => ["contact", "blocked"],
-                       "dfrn-request" => ["contact", "request"],
                        "dfrn-notify" => ["contact", "notify"],
                        "dfrn-poll" => ["contact", "poll"],
-                       "dfrn-confirm" => ["contact", "confirm"],
                        "diaspora-guid" => ["fcontact", "guid"],
                        "diaspora-batch" => ["fcontact", "batch"],
                        "diaspora-notify" => ["fcontact", "notify"],
                        "ap-following_count" => ["apcontact", "following_count"],
                        "ap-followers_count" => ["apcontact", "followers_count"],
                        "ap-statuses_count" => ["apcontact", "statuses_count"],
+                       "site_name" => ["gserver", "site_name"],
+                       "platform" => ["gserver", "platform"],
+                       "version" => ["gserver", "version"],
                ],
                "query" => "FROM `contact`
                        LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
                        LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `contact`.`uri-id`
                        LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = contact.`uri-id`
+                       LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`
                        WHERE `contact`.`uid` = 0"                      
        ],
        "account-user-view" => [
                        "subhub" => ["ucontact", "subhub"],
                        "hub-verify" => ["ucontact", "hub-verify"],
                        "reason" => ["ucontact", "reason"],
-                       "dfrn-request" => ["contact", "request"],
                        "dfrn-notify" => ["contact", "notify"],
                        "dfrn-poll" => ["contact", "poll"],
-                       "dfrn-confirm" => ["contact", "confirm"],
                        "diaspora-guid" => ["fcontact", "guid"],
                        "diaspora-batch" => ["fcontact", "batch"],
                        "diaspora-notify" => ["fcontact", "notify"],
                        "ap-following_count" => ["apcontact", "following_count"],
                        "ap-followers_count" => ["apcontact", "followers_count"],
                        "ap-statuses_count" => ["apcontact", "statuses_count"],
+                       "site_name" => ["gserver", "site_name"],
+                       "platform" => ["gserver", "platform"],
+                       "version" => ["gserver", "version"],
                ],
                "query" => "FROM `contact` AS `ucontact`
                        INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0
                        LEFT JOIN `item-uri` ON `item-uri`.`id` = `ucontact`.`uri-id`
                        LEFT JOIN `apcontact` ON `apcontact`.`uri-id` = `ucontact`.`uri-id`
-                       LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = `ucontact`.`uri-id` AND `fcontact`.`network` = 'dspr'"
+                       LEFT JOIN `fcontact` ON `fcontact`.`uri-id` = `ucontact`.`uri-id` AND `fcontact`.`network` = 'dspr'
+                       LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`"
        ],
        "pending-view" => [
                "fields" => [