From e98dbb3366b2437dee0dd6f80eda848db68b415b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Fri, 6 Oct 2023 01:26:43 +0200 Subject: [PATCH] add mention-/showgroup button also to profile/vcard.tpl i don't know why, but $profile['id'] in src/Model/Profile.php gives the wrong group-id. for users, the id is correct. --- src/Model/Contact.php | 12 ++++-------- src/Model/Profile.php | 16 ++++++++++++++++ view/theme/frio/templates/profile/vcard.tpl | 11 +++++++++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 3e547fcaff..be3cec4701 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1198,20 +1198,16 @@ class Contact $pm_url = 'message/new/' . $contact['id']; } - if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) { - $mention_label = DI::l10n()->t('Post to group'); - $mention_url = 'compose/0?body=!' . $contact['addr']; - } else { - $mention_label = DI::l10n()->t('Mention'); - $mention_url = 'compose/0?body=@' . $contact['addr']; - } - $contact_url = 'contact/' . $contact['id']; if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) { + $mention_label = DI::l10n()->t('Post to group'); + $mention_url = 'compose/0?body=!' . $contact['addr']; $network_label = DI::l10n()->t('View group'); $network_url = 'network/group/' . $contact['id']; } else { + $mention_label = DI::l10n()->t('Mention'); + $mention_url = 'compose/0?body=@' . $contact['addr']; $network_label = DI::l10n()->t('Network Posts'); $network_url = 'contact/' . $contact['id'] . '/conversations'; } diff --git a/src/Model/Profile.php b/src/Model/Profile.php index 9c7aab54ad..0aa44c6735 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -453,6 +453,18 @@ class Profile Logger::warning('Missing hidewall key in profile array', ['profile' => $profile, 'callstack' => System::callstack(10)]); } + if ($profile['account-type'] == Contact::TYPE_COMMUNITY) { + $mention_label = DI::l10n()->t('Post to group'); + $mention_url = 'compose/0?body=!' . $profile['addr']; + $network_label = DI::l10n()->t('View group'); + $network_url = 'network/group/' . $profile['id']; + } else { + $mention_label = DI::l10n()->t('Mention'); + $mention_url = 'compose/0?body=@' . $profile['addr']; + $network_label = DI::l10n()->t('Network Posts'); + $network_url = 'contact/' . $profile['id'] . '/conversations'; + } + $tpl = Renderer::getMarkupTemplate('profile/vcard.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$profile' => $p, @@ -476,6 +488,10 @@ class Profile '$updated' => $updated, '$diaspora' => $diaspora, '$contact_block' => $contact_block, + '$mention_label' => $mention_label, + '$mention_url' => $mention_url, + '$network_label' => $network_label, + '$network_url' => $network_url, ]); $arr = ['profile' => &$profile, 'entry' => &$o]; diff --git a/view/theme/frio/templates/profile/vcard.tpl b/view/theme/frio/templates/profile/vcard.tpl index 94f62bd0d3..86d6bd9179 100644 --- a/view/theme/frio/templates/profile/vcard.tpl +++ b/view/theme/frio/templates/profile/vcard.tpl @@ -72,9 +72,16 @@ {{/if}} {{if $profile.addr}} + {{/if}} + {{if $network_label}} +
+
{{/if}}