-- ------------------------------------------
-- Friendica 2023.09-dev (Giant Rhubarb)
--- DB_UPDATE_VERSION 1522
+-- DB_UPDATE_VERSION 1523
-- ------------------------------------------
FROM `application-token`
INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`;
+--
+-- VIEW circle-member-view
+--
+DROP VIEW IF EXISTS `circle-member-view`;
+CREATE VIEW `circle-member-view` AS SELECT
+ `group_member`.`id` AS `id`,
+ `group`.`uid` AS `uid`,
+ `group_member`.`contact-id` AS `contact-id`,
+ `contact`.`uri-id` AS `contact-uri-id`,
+ `contact`.`url` AS `contact-link`,
+ `contact`.`addr` AS `contact-addr`,
+ `contact`.`name` AS `contact-name`,
+ `contact`.`nick` AS `contact-nick`,
+ `contact`.`thumb` AS `contact-avatar`,
+ `contact`.`network` AS `contact-network`,
+ `contact`.`blocked` AS `contact-blocked`,
+ `contact`.`hidden` AS `contact-hidden`,
+ `contact`.`readonly` AS `contact-readonly`,
+ `contact`.`archive` AS `contact-archive`,
+ `contact`.`pending` AS `contact-pending`,
+ `contact`.`self` AS `contact-self`,
+ `contact`.`rel` AS `contact-rel`,
+ `contact`.`contact-type` AS `contact-contact-type`,
+ `group_member`.`gid` AS `circle-id`,
+ `group`.`visible` AS `circle-visible`,
+ `group`.`deleted` AS `circle-deleted`,
+ `group`.`name` AS `circle-name`
+ FROM `group_member`
+ INNER JOIN `contact` ON `group_member`.`contact-id` = `contact`.`id`
+ INNER JOIN `group` ON `group_member`.`gid` = `group`.`id`;
+
--
-- VIEW post-user-view
--
namespace Friendica\Model;
use Friendica\BaseModule;
+use Friendica\Content\Widget;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
}
if ($each == 'circle') {
- $count = DBA::count('group_member', ['gid' => $circle['id']]);
+ $networks = Widget::unavailableNetworks();
+ $sql_values = array_merge([$circle['id']], $networks);
+ $condition = ["`circle-id` = ? AND NOT `contact-network` IN (" . substr(str_repeat("?, ", count($networks)), 0, -2) . ")"];
+ $condition = array_merge($condition, $sql_values);
+
+ $count = DBA::count('circle-member-view', $condition);
$circle_name = sprintf('%s (%d)', $circle['name'], $count);
} else {
$circle_name = $circle['name'];
namespace Friendica\Model\Contact;
+use Friendica\Content\Widget;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
$return = [];
if (intval($gid)) {
+ $networks = Widget::unavailableNetworks();
+ $sql_values = array_merge([$gid, DI::userSession()->getLocalUserId()], $networks);
+
$stmt = DBA::p('SELECT `circle_member`.`contact-id`, `contact`.*
FROM `contact`
INNER JOIN `group_member` AS `circle_member`
AND NOT `contact`.`deleted`
AND NOT `contact`.`blocked`
AND NOT `contact`.`pending`
+ AND NOT `contact`.`network` IN (' . substr(str_repeat('?, ', count($networks)), 0, -2) . ')
ORDER BY `contact`.`name` ASC',
- $gid,
- DI::userSession()->getLocalUserId()
+ $sql_values
);
if (DBA::isResult($stmt)) {
*/
public static function listUncircled(int $uid)
{
- return Contact::selectToArray([], ["`uid` = ? AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `failed`
+ $networks = Widget::unavailableNetworks();
+ $query = "`uid` = ? AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `failed`
+ AND NOT `network` IN (" . substr(str_repeat('?, ', count($networks)), 0, -2) . ")
AND `id` NOT IN (SELECT DISTINCT(`contact-id`) FROM `group_member` AS `circle_member` INNER JOIN `group` AS `circle` ON `circle`.`id` = `circle_member`.`gid`
- WHERE `circle`.`uid` = ? AND `contact-id` = `contact`.`id`)", $uid, $uid]);
+ WHERE `circle`.`uid` = ? AND `contact-id` = `contact`.`id`)";
+ $condition = array_merge([$query], [$uid], $networks, [$uid]);
+
+ return Contact::selectToArray([], $condition);
}
/**
'akkoma' => ['name' => 'Akkoma', 'color' => '#9574cd'], // Color from the page
'birdsitelive' => ['name' => 'BirdsiteLIVE', 'color' => '#1b6ec2'], // Color from the page
'bookwyrm' => ['name' => 'BookWyrm', 'color' => '#00d1b2'], // Color from the page
- 'calckey' => ['name' => 'Calckey', 'color' => '#286983'], // Color from the page
'castopod' => ['name' => 'Castopod', 'color' => '#00564a'], // Background color from the page
'diaspora' => ['name' => 'Diaspora', 'color' => '#a1a1a1'], // logo is black and white, makes a gray
+ 'calckey' => ['name' => 'firefish (Calckey)', 'color' => '#1c4a5c'], // Color from the page
'foundkey' => ['name' => 'Foundkey', 'color' => '#609926'], // Some random color from the repository
'funkwhale' => ['name' => 'Funkwhale', 'color' => '#4082B4'], // From the homepage
'gancio' => ['name' => 'Gancio', 'color' => '#7253ed'], // Fontcolor from the page
$version['version'] = $gserver['platform'] . ' ' . $version['version'];
} elseif (in_array($gserver['platform'], ['activityrelay', 'pub-relay', 'selective-relay', 'aoderelay'])) {
$version['version'] = $gserver['platform'] . '-' . $version['version'];
+ } elseif (in_array($gserver['platform'], ['calckey', 'firefish'])) {
+ $version['version'] = $gserver['platform'] . '-' . $version['version'];
}
$versionCounts[] = $version;
if ($platform == 'friendika') {
$platform = 'friendica';
+ } elseif (in_array($platform, ['calckey', 'firefish'])) {
+ $platform = 'calckey';
} elseif (in_array($platform, ['red matrix', 'redmatrix', 'red'])) {
$platform = 'hubzilla';
} elseif (in_array($platform, ['osada', 'mistpark', 'roadhouse', 'streams', 'zap'])) {
namespace Friendica\Module;
use Friendica\BaseModule;
+use Friendica\Content\Widget;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
throw new \Friendica\Network\HTTPException\ForbiddenException();
}
- $a = DI::app();
-
DI::page()['aside'] = Model\Circle::sidebarWidget('contact', 'circle', 'extended', ((DI::args()->getArgc() > 1) ? DI::args()->getArgv()[1] : 'everyone'));
// With no circle number provided we jump to the unassigned contacts as a starting point
if ($nocircle) {
$contacts = Model\Contact\Circle::listUncircled(DI::userSession()->getLocalUserId());
} else {
- $contacts_stmt = DBA::select('contact', [],
- ['rel' => [Model\Contact::FOLLOWER, Model\Contact::FRIEND, Model\Contact::SHARING],
- 'uid' => DI::userSession()->getLocalUserId(), 'pending' => false, 'blocked' => false, 'failed' => false, 'self' => false],
- ['order' => ['name']]
- );
+ $networks = Widget::unavailableNetworks();
+ $query = "`uid` = ? AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `failed`
+ AND `rel` IN (?, ?, ?)
+ AND NOT `network` IN (" . substr(str_repeat('?, ', count($networks)), 0, -2) . ")";
+ $condition = array_merge([$query], [DI::userSession()->getLocalUserId(), Model\Contact::FOLLOWER, Model\Contact::FRIEND, Model\Contact::SHARING], $networks);
+
+ $contacts_stmt = DBA::select('contact', [], $condition, ['order' => ['name']]);
$contacts = DBA::toArray($contacts_stmt);
$context['$desc'] = DI::l10n()->t('Click on a contact to add or remove.');
}
// This file is required several times during the test in DbaDefinition which justifies this condition
if (!defined('DB_UPDATE_VERSION')) {
- define('DB_UPDATE_VERSION', 1522);
+ define('DB_UPDATE_VERSION', 1523);
}
return [
"query" => "FROM `application-token`
INNER JOIN `application` ON `application-token`.`application-id` = `application`.`id`"
],
+ "circle-member-view" => [
+ "fields" => [
+ "id" => ["group_member", "id"],
+ "uid" => ["group", "uid"],
+ "contact-id" => ["group_member", "contact-id"],
+ "contact-uri-id" => ["contact", "uri-id"],
+ "contact-link" => ["contact", "url"],
+ "contact-addr" => ["contact", "addr"],
+ "contact-name" => ["contact", "name"],
+ "contact-nick" => ["contact", "nick"],
+ "contact-avatar" => ["contact", "thumb"],
+ "contact-network" => ["contact", "network"],
+ "contact-blocked" => ["contact", "blocked"],
+ "contact-hidden" => ["contact", "hidden"],
+ "contact-readonly" => ["contact", "readonly"],
+ "contact-archive" => ["contact", "archive"],
+ "contact-pending" => ["contact", "pending"],
+ "contact-self" => ["contact", "self"],
+ "contact-rel" => ["contact", "rel"],
+ "contact-contact-type" => ["contact", "contact-type"],
+ "circle-id" => ["group_member", "gid"],
+ "circle-visible" => ["group", "visible"],
+ "circle-deleted" => ["group", "deleted"],
+ "circle-name" => ["group", "name"],
+ ],
+ "query" => "FROM `group_member`
+ INNER JOIN `contact` ON `group_member`.`contact-id` = `contact`.`id`
+ INNER JOIN `group` ON `group_member`.`gid` = `group`.`id`"
+ ],
"post-user-view" => [
"fields" => [
"id" => ["post-user", "id"],