Avoid duplicated post button on the contact conversation page

This commit is contained in:
Michael 2024-02-01 16:12:11 +00:00
parent 665316c14d
commit bd0149debe
2 changed files with 9 additions and 6 deletions

View File

@ -28,7 +28,6 @@ use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Util\Network;
use Friendica\Util\Strings;
/**
@ -42,9 +41,11 @@ class VCard
* Get HTML for vcard block
*
* @template widget/vcard.tpl
* @param array $contact
* @param bool $hide_mention
* @return string
*/
public static function getHTML(array $contact): string
public static function getHTML(array $contact, bool $hide_mention = false): string
{
if (!isset($contact['network']) || !isset($contact['id'])) {
Logger::warning('Incomplete contact', ['contact' => $contact ?? []]);
@ -99,10 +100,12 @@ class VCard
}
if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) {
$mention_label = DI::l10n()->t('Post to group');
$mention_link = 'compose/0?body=!' . $contact['addr'];
if (!$hide_mention) {
$mention_label = DI::l10n()->t('Post to group');
$mention_link = 'compose/0?body=!' . $contact['addr'];
}
$showgroup_link = 'network/group/' . $id;
} else {
} elseif (!$hide_mention) {
$mention_label = DI::l10n()->t('Mention');
$mention_link = 'compose/0?body=@' . $contact['addr'];
}

View File

@ -107,7 +107,7 @@ class Conversations extends BaseModule
$this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css'));
$this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css'));
$this->page['aside'] .= Widget\VCard::getHTML($contact);
$this->page['aside'] .= Widget\VCard::getHTML($contact, true);
Nav::setSelected('contact');