set variables for correct mentioning

This commit is contained in:
Jakobus Schürz (admin) 2023-10-01 22:37:34 +02:00
parent a06e6c7f47
commit 4b161b0d65

View File

@ -1180,6 +1180,7 @@ class Contact
$mention_url = ''; $mention_url = '';
$status_link = ''; $status_link = '';
$photos_link = ''; $photos_link = '';
$self = false;
if (($contact['network'] === Protocol::DFRN) && !$contact['self'] && empty($contact['pending'])) { if (($contact['network'] === Protocol::DFRN) && !$contact['self'] && empty($contact['pending'])) {
$profile_link = 'contact/redir/' . $contact['id']; $profile_link = 'contact/redir/' . $contact['id'];
@ -1203,6 +1204,12 @@ class Contact
} else { } else {
$mention_url = 'compose/0?body=@' . $contact['addr']; $mention_url = 'compose/0?body=@' . $contact['addr'];
} }
if (in_array($contact['rel'], [contact::SHARING])) {
$self = true;
}
$contact_url = 'contact/' . $contact['id']; $contact_url = 'contact/' . $contact['id'];
$posts_link = 'contact/' . $contact['id'] . '/conversations'; $posts_link = 'contact/' . $contact['id'] . '/conversations';
$group_link = 'network/group/' . $contact['id']; $group_link = 'network/group/' . $contact['id'];
@ -1228,6 +1235,8 @@ class Contact
'edit' => [DI::l10n()->t('View Contact'), $contact_url, false], 'edit' => [DI::l10n()->t('View Contact'), $contact_url, false],
'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link, true], 'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link, true],
'unfollow' => [DI::l10n()->t('Unfollow'), $unfollow_link, true], 'unfollow' => [DI::l10n()->t('Unfollow'), $unfollow_link, true],
'mention' => [DI::l10n()->t('Mention'), DI::l10n()->t('Post to group'), $mention_url, false],
'group' => [DI::l10n()->t('View group'), $group_link, $contact['forum'], true],
]; ];
} else { } else {
$menu = [ $menu = [
@ -1241,6 +1250,7 @@ class Contact
'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link, true], 'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link, true],
'unfollow' => [DI::l10n()->t('Unfollow'), $unfollow_link, true], 'unfollow' => [DI::l10n()->t('Unfollow'), $unfollow_link, true],
'group' => [DI::l10n()->t('View group'), $group_link, $contact['forum'], true], 'group' => [DI::l10n()->t('View group'), $group_link, $contact['forum'], true],
'self' => [$self],
]; ];
if (!empty($contact['pending'])) { if (!empty($contact['pending'])) {