Use gsid for the network name

This commit is contained in:
Michael 2022-04-29 07:47:24 +00:00
parent d44641e58c
commit d3de2497bc
6 changed files with 22 additions and 7 deletions

View file

@ -1720,6 +1720,7 @@ CREATE VIEW `post-user-view` AS SELECT
`author`.`blocked` AS `author-blocked`, `author`.`blocked` AS `author-blocked`,
`author`.`hidden` AS `author-hidden`, `author`.`hidden` AS `author-hidden`,
`author`.`updated` AS `author-updated`, `author`.`updated` AS `author-updated`,
`author`.`gsid` AS `author-gsid`,
`post-user`.`owner-id` AS `owner-id`, `post-user`.`owner-id` AS `owner-id`,
`owner`.`url` AS `owner-link`, `owner`.`url` AS `owner-link`,
`owner`.`addr` AS `owner-addr`, `owner`.`addr` AS `owner-addr`,
@ -1887,6 +1888,7 @@ CREATE VIEW `post-thread-user-view` AS SELECT
`author`.`blocked` AS `author-blocked`, `author`.`blocked` AS `author-blocked`,
`author`.`hidden` AS `author-hidden`, `author`.`hidden` AS `author-hidden`,
`author`.`updated` AS `author-updated`, `author`.`updated` AS `author-updated`,
`author`.`gsid` AS `author-gsid`,
`post-thread-user`.`owner-id` AS `owner-id`, `post-thread-user`.`owner-id` AS `owner-id`,
`owner`.`url` AS `owner-link`, `owner`.`url` AS `owner-link`,
`owner`.`addr` AS `owner-addr`, `owner`.`addr` AS `owner-addr`,
@ -2040,6 +2042,7 @@ CREATE VIEW `post-view` AS SELECT
`author`.`blocked` AS `author-blocked`, `author`.`blocked` AS `author-blocked`,
`author`.`hidden` AS `author-hidden`, `author`.`hidden` AS `author-hidden`,
`author`.`updated` AS `author-updated`, `author`.`updated` AS `author-updated`,
`author`.`gsid` AS `author-gsid`,
`post`.`owner-id` AS `owner-id`, `post`.`owner-id` AS `owner-id`,
`owner`.`url` AS `owner-link`, `owner`.`url` AS `owner-link`,
`owner`.`addr` AS `owner-addr`, `owner`.`addr` AS `owner-addr`,
@ -2169,6 +2172,7 @@ CREATE VIEW `post-thread-view` AS SELECT
`author`.`blocked` AS `author-blocked`, `author`.`blocked` AS `author-blocked`,
`author`.`hidden` AS `author-hidden`, `author`.`hidden` AS `author-hidden`,
`author`.`updated` AS `author-updated`, `author`.`updated` AS `author-updated`,
`author`.`gsid` AS `author-gsid`,
`post-thread`.`owner-id` AS `owner-id`, `post-thread`.`owner-id` AS `owner-id`,
`owner`.`url` AS `owner-link`, `owner`.`url` AS `owner-link`,
`owner`.`addr` AS `owner-addr`, `owner`.`addr` AS `owner-addr`,

View file

@ -184,7 +184,7 @@ class ContactSelector
* @return string * @return string
* @throws \Exception * @throws \Exception
*/ */
public static function networkToIcon($network, $profile = "") public static function networkToIcon($network, $profile = "", $gsid = 0)
{ {
$nets = [ $nets = [
Protocol::DFRN => 'friendica', Protocol::DFRN => 'friendica',
@ -218,7 +218,14 @@ class ContactSelector
$network_icon = str_replace($search, $replace, $network); $network_icon = str_replace($search, $replace, $network);
if ((in_array($network, Protocol::FEDERATED)) && ($profile != "")) { if ((in_array($network, Protocol::FEDERATED)) && ($profile != "")) {
$gserver = self::getServerForProfile($profile); if (!empty($gsid) && !empty(self::$serverdata[$gsid])) {
$gserver = self::$serverdata[$gsid];
} elseif (!empty($gsid)) {
$gserver = DBA::selectFirst('gserver', ['platform', 'network'], ['id' => $gsid]);
self::$serverdata[$gsid] = $gserver;
} else {
$gserver = self::getServerForProfile($profile);
}
if (!empty($gserver['platform'])) { if (!empty($gserver['platform'])) {
$network_icon = $platform_icons[strtolower($gserver['platform'])] ?? $network_icon; $network_icon = $platform_icons[strtolower($gserver['platform'])] ?? $network_icon;
} }

View file

@ -678,8 +678,8 @@ class Conversation
'created_date' => $item['created'], 'created_date' => $item['created'],
'uriid' => $item['uri-id'], 'uriid' => $item['uri-id'],
'network' => $item['network'], 'network' => $item['network'],
'network_name' => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network']), 'network_name' => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network'], $item['author-gsid']),
'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link']), 'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link'], $item['author-gsid']),
'linktitle' => $this->l10n->t('View %s\'s profile @ %s', $profile_name, $item['author-link']), 'linktitle' => $this->l10n->t('View %s\'s profile @ %s', $profile_name, $item['author-link']),
'profile_url' => $profile_link, 'profile_url' => $profile_link,
'item_photo_menu_html' => $this->item->photoMenu($item, $formSecurityToken), 'item_photo_menu_html' => $this->item->photoMenu($item, $formSecurityToken),

View file

@ -87,7 +87,7 @@ class Item
'wall', 'private', 'starred', 'origin', 'parent-origin', 'title', 'body', 'language', 'wall', 'private', 'starred', 'origin', 'parent-origin', 'title', 'body', 'language',
'content-warning', 'location', 'coord', 'app', 'rendered-hash', 'rendered-html', 'object', 'content-warning', 'location', 'coord', 'app', 'rendered-hash', 'rendered-html', 'object',
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'mention', 'global', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'mention', 'global',
'author-id', 'author-link', 'author-name', 'author-avatar', 'author-network', 'author-updated', 'author-id', 'author-link', 'author-name', 'author-avatar', 'author-network', 'author-updated', 'author-gsid',
'owner-id', 'owner-link', 'owner-name', 'owner-avatar', 'owner-network', 'owner-contact-type', 'owner-updated', 'owner-id', 'owner-link', 'owner-name', 'owner-avatar', 'owner-network', 'owner-contact-type', 'owner-updated',
'causer-id', 'causer-link', 'causer-name', 'causer-avatar', 'causer-contact-type', 'causer-network', 'causer-id', 'causer-link', 'causer-name', 'causer-avatar', 'causer-contact-type', 'causer-network',
'contact-id', 'contact-uid', 'contact-link', 'contact-name', 'contact-avatar', 'contact-id', 'contact-uid', 'contact-link', 'contact-name', 'contact-avatar',

View file

@ -538,8 +538,8 @@ class Post
'thread_level' => $thread_level, 'thread_level' => $thread_level,
'edited' => $edited, 'edited' => $edited,
'network' => $item["network"], 'network' => $item["network"],
'network_name' => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network']), 'network_name' => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network'], $item['author-gsid']),
'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link']), 'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link'], $item['author-gsid']),
'received' => $item['received'], 'received' => $item['received'],
'commented' => $item['commented'], 'commented' => $item['commented'],
'created_date' => $item['created'], 'created_date' => $item['created'],

View file

@ -147,6 +147,7 @@
"author-blocked" => ["author", "blocked"], "author-blocked" => ["author", "blocked"],
"author-hidden" => ["author", "hidden"], "author-hidden" => ["author", "hidden"],
"author-updated" => ["author", "updated"], "author-updated" => ["author", "updated"],
"author-gsid" => ["author", "gsid"],
"owner-id" => ["post-user", "owner-id"], "owner-id" => ["post-user", "owner-id"],
"owner-link" => ["owner", "url"], "owner-link" => ["owner", "url"],
"owner-addr" => ["owner", "addr"], "owner-addr" => ["owner", "addr"],
@ -312,6 +313,7 @@
"author-blocked" => ["author", "blocked"], "author-blocked" => ["author", "blocked"],
"author-hidden" => ["author", "hidden"], "author-hidden" => ["author", "hidden"],
"author-updated" => ["author", "updated"], "author-updated" => ["author", "updated"],
"author-gsid" => ["author", "gsid"],
"owner-id" => ["post-thread-user", "owner-id"], "owner-id" => ["post-thread-user", "owner-id"],
"owner-link" => ["owner", "url"], "owner-link" => ["owner", "url"],
"owner-addr" => ["owner", "addr"], "owner-addr" => ["owner", "addr"],
@ -463,6 +465,7 @@
"author-blocked" => ["author", "blocked"], "author-blocked" => ["author", "blocked"],
"author-hidden" => ["author", "hidden"], "author-hidden" => ["author", "hidden"],
"author-updated" => ["author", "updated"], "author-updated" => ["author", "updated"],
"author-gsid" => ["author", "gsid"],
"owner-id" => ["post", "owner-id"], "owner-id" => ["post", "owner-id"],
"owner-link" => ["owner", "url"], "owner-link" => ["owner", "url"],
"owner-addr" => ["owner", "addr"], "owner-addr" => ["owner", "addr"],
@ -590,6 +593,7 @@
"author-blocked" => ["author", "blocked"], "author-blocked" => ["author", "blocked"],
"author-hidden" => ["author", "hidden"], "author-hidden" => ["author", "hidden"],
"author-updated" => ["author", "updated"], "author-updated" => ["author", "updated"],
"author-gsid" => ["author", "gsid"],
"owner-id" => ["post-thread", "owner-id"], "owner-id" => ["post-thread", "owner-id"],
"owner-link" => ["owner", "url"], "owner-link" => ["owner", "url"],
"owner-addr" => ["owner", "addr"], "owner-addr" => ["owner", "addr"],