Merge pull request #11376 from annando/no-group

Don't display Peertube groups as forums
This commit is contained in:
Tobias Diekershoff 2022-03-24 13:19:34 +01:00 committed by GitHub
commit c1fd163b97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 22 deletions

View File

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 2022.05-dev (Siberian Iris) -- 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`.`archive` AS `archive`,
`contact`.`deleted` AS `deleted`, `contact`.`deleted` AS `deleted`,
`contact`.`blocked` AS `blocked`, `contact`.`blocked` AS `blocked`,
`contact`.`request` AS `dfrn-request`,
`contact`.`notify` AS `dfrn-notify`, `contact`.`notify` AS `dfrn-notify`,
`contact`.`poll` AS `dfrn-poll`, `contact`.`poll` AS `dfrn-poll`,
`contact`.`confirm` AS `dfrn-confirm`,
`fcontact`.`guid` AS `diaspora-guid`, `fcontact`.`guid` AS `diaspora-guid`,
`fcontact`.`batch` AS `diaspora-batch`, `fcontact`.`batch` AS `diaspora-batch`,
`fcontact`.`notify` AS `diaspora-notify`, `fcontact`.`notify` AS `diaspora-notify`,
@ -2431,11 +2429,15 @@ CREATE VIEW `account-view` AS SELECT
`apcontact`.`generator` AS `ap-generator`, `apcontact`.`generator` AS `ap-generator`,
`apcontact`.`following_count` AS `ap-following_count`, `apcontact`.`following_count` AS `ap-following_count`,
`apcontact`.`followers_count` AS `ap-followers_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` FROM `contact`
LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id` LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
LEFT JOIN `apcontact` ON `apcontact`.`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 `fcontact` ON `fcontact`.`uri-id` = contact.`uri-id`
LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`
WHERE `contact`.`uid` = 0; WHERE `contact`.`uid` = 0;
-- --
@ -2511,10 +2513,8 @@ CREATE VIEW `account-user-view` AS SELECT
`ucontact`.`subhub` AS `subhub`, `ucontact`.`subhub` AS `subhub`,
`ucontact`.`hub-verify` AS `hub-verify`, `ucontact`.`hub-verify` AS `hub-verify`,
`ucontact`.`reason` AS `reason`, `ucontact`.`reason` AS `reason`,
`contact`.`request` AS `dfrn-request`,
`contact`.`notify` AS `dfrn-notify`, `contact`.`notify` AS `dfrn-notify`,
`contact`.`poll` AS `dfrn-poll`, `contact`.`poll` AS `dfrn-poll`,
`contact`.`confirm` AS `dfrn-confirm`,
`fcontact`.`guid` AS `diaspora-guid`, `fcontact`.`guid` AS `diaspora-guid`,
`fcontact`.`batch` AS `diaspora-batch`, `fcontact`.`batch` AS `diaspora-batch`,
`fcontact`.`notify` AS `diaspora-notify`, `fcontact`.`notify` AS `diaspora-notify`,
@ -2530,12 +2530,16 @@ CREATE VIEW `account-user-view` AS SELECT
`apcontact`.`generator` AS `ap-generator`, `apcontact`.`generator` AS `ap-generator`,
`apcontact`.`following_count` AS `ap-following_count`, `apcontact`.`following_count` AS `ap-following_count`,
`apcontact`.`followers_count` AS `ap-followers_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` FROM `contact` AS `ucontact`
INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0 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 `item-uri` ON `item-uri`.`id` = `ucontact`.`uri-id`
LEFT JOIN `apcontact` ON `apcontact`.`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 pending-view

View File

@ -57,23 +57,29 @@ class ForumManager
$params = ['order' => ['name']]; $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 = DBA::mergeConditions($condition, ["`platform` != ?", 'peertube']);
$condition_str .= '(`forum` OR `prv`)';
} else { if (!$showprivate) {
$condition_str .= '`forum`'; $condition = DBA::mergeConditions($condition, ['manually-approve' => false]);
} }
if (!$showhidden) { if (!$showhidden) {
$condition_str .= ' AND NOT `hidden`'; $condition = DBA::mergeConditions($condition, ['hidden' => false]);
} }
$forumlist = []; $forumlist = [];
$fields = ['id', 'url', 'name', 'micro', 'thumb', 'avatar', 'network', 'uid']; $fields = ['id', 'url', 'name', 'micro', 'thumb', 'avatar', 'network', 'uid'];
$condition = [$condition_str, Protocol::DFRN, Protocol::ACTIVITYPUB, $uid]; $contacts = DBA::select('account-user-view', $fields, $condition, $params);
$contacts = DBA::select('contact', $fields, $condition, $params);
if (!$contacts) { if (!$contacts) {
return($forumlist); return($forumlist);
} }

View File

@ -55,7 +55,7 @@
use Friendica\Database\DBA; use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) { if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1452); define('DB_UPDATE_VERSION', 1453);
} }
return [ return [

View File

@ -873,10 +873,8 @@
"archive" => ["contact", "archive"], "archive" => ["contact", "archive"],
"deleted" => ["contact", "deleted"], "deleted" => ["contact", "deleted"],
"blocked" => ["contact", "blocked"], "blocked" => ["contact", "blocked"],
"dfrn-request" => ["contact", "request"],
"dfrn-notify" => ["contact", "notify"], "dfrn-notify" => ["contact", "notify"],
"dfrn-poll" => ["contact", "poll"], "dfrn-poll" => ["contact", "poll"],
"dfrn-confirm" => ["contact", "confirm"],
"diaspora-guid" => ["fcontact", "guid"], "diaspora-guid" => ["fcontact", "guid"],
"diaspora-batch" => ["fcontact", "batch"], "diaspora-batch" => ["fcontact", "batch"],
"diaspora-notify" => ["fcontact", "notify"], "diaspora-notify" => ["fcontact", "notify"],
@ -893,11 +891,15 @@
"ap-following_count" => ["apcontact", "following_count"], "ap-following_count" => ["apcontact", "following_count"],
"ap-followers_count" => ["apcontact", "followers_count"], "ap-followers_count" => ["apcontact", "followers_count"],
"ap-statuses_count" => ["apcontact", "statuses_count"], "ap-statuses_count" => ["apcontact", "statuses_count"],
"site_name" => ["gserver", "site_name"],
"platform" => ["gserver", "platform"],
"version" => ["gserver", "version"],
], ],
"query" => "FROM `contact` "query" => "FROM `contact`
LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id` LEFT JOIN `item-uri` ON `item-uri`.`id` = `contact`.`uri-id`
LEFT JOIN `apcontact` ON `apcontact`.`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 `fcontact` ON `fcontact`.`uri-id` = contact.`uri-id`
LEFT JOIN `gserver` ON `gserver`.`id` = contact.`gsid`
WHERE `contact`.`uid` = 0" WHERE `contact`.`uid` = 0"
], ],
"account-user-view" => [ "account-user-view" => [
@ -970,10 +972,8 @@
"subhub" => ["ucontact", "subhub"], "subhub" => ["ucontact", "subhub"],
"hub-verify" => ["ucontact", "hub-verify"], "hub-verify" => ["ucontact", "hub-verify"],
"reason" => ["ucontact", "reason"], "reason" => ["ucontact", "reason"],
"dfrn-request" => ["contact", "request"],
"dfrn-notify" => ["contact", "notify"], "dfrn-notify" => ["contact", "notify"],
"dfrn-poll" => ["contact", "poll"], "dfrn-poll" => ["contact", "poll"],
"dfrn-confirm" => ["contact", "confirm"],
"diaspora-guid" => ["fcontact", "guid"], "diaspora-guid" => ["fcontact", "guid"],
"diaspora-batch" => ["fcontact", "batch"], "diaspora-batch" => ["fcontact", "batch"],
"diaspora-notify" => ["fcontact", "notify"], "diaspora-notify" => ["fcontact", "notify"],
@ -990,12 +990,16 @@
"ap-following_count" => ["apcontact", "following_count"], "ap-following_count" => ["apcontact", "following_count"],
"ap-followers_count" => ["apcontact", "followers_count"], "ap-followers_count" => ["apcontact", "followers_count"],
"ap-statuses_count" => ["apcontact", "statuses_count"], "ap-statuses_count" => ["apcontact", "statuses_count"],
"site_name" => ["gserver", "site_name"],
"platform" => ["gserver", "platform"],
"version" => ["gserver", "version"],
], ],
"query" => "FROM `contact` AS `ucontact` "query" => "FROM `contact` AS `ucontact`
INNER JOIN `contact` ON `contact`.`uri-id` = `ucontact`.`uri-id` AND `contact`.`uid` = 0 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 `item-uri` ON `item-uri`.`id` = `ucontact`.`uri-id`
LEFT JOIN `apcontact` ON `apcontact`.`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" => [ "pending-view" => [
"fields" => [ "fields" => [