Don't display Peertube groups as forums

This commit is contained in:
Michael 2022-03-24 11:30:32 +00:00
parent aa1ef0516d
commit 8c34c3b8ae
4 changed files with 36 additions and 22 deletions

View 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

View 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 ";
$condition = [
'contact-type' => Contact::TYPE_COMMUNITY,
'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB],
'uid' => $uid,
'blocked' => false,
'pending' => false,
'archive' => false,
];
if ($showprivate) {
$condition_str .= '(`forum` OR `prv`)';
} else {
$condition_str .= '`forum`';
$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);
}

View 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 [

View File

@ -873,10 +873,8 @@
"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"],
@ -893,11 +891,15 @@
"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" => [
@ -970,10 +972,8 @@
"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"],
@ -990,12 +990,16 @@
"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" => [