From: Hypolite Petovan Date: Sat, 5 Nov 2022 22:15:25 +0000 (-0400) Subject: Add follow/unfollow link to the contact actions menu X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d5b29b1c61951cd3a805c4edd8d589d6954c8280;p=friendica.git Add follow/unfollow link to the contact actions menu --- diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index ec1c6b55bc..eaf9993fc1 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -415,6 +415,24 @@ class Profile extends BaseModule $formSecurityToken = self::getFormSecurityToken('contact_action'); + if ($localRelationship->rel & Contact::SHARING) { + $contact_actions['unfollow'] = [ + 'label' => $this->t('Unfollow'), + 'url' => 'contact/unfollow?url=' . urlencode($contact['url']) . '&auto=1', + 'title' => '', + 'sel' => '', + 'id' => 'unfollow', + ]; + } else { + $contact_actions['follow'] = [ + 'label' => $this->t('Follow'), + 'url' => 'contact/follow?url=' . urlencode($contact['url']) . '&auto=1', + 'title' => '', + 'sel' => '', + 'id' => 'follow', + ]; + } + // Provide friend suggestion only for Friendica contacts if ($contact['network'] === Protocol::DFRN) { $contact_actions['suggest'] = [ diff --git a/view/templates/contact_edit.tpl b/view/templates/contact_edit.tpl index 90b163cb0f..2b84657c88 100644 --- a/view/templates/contact_edit.tpl +++ b/view/templates/contact_edit.tpl @@ -15,6 +15,8 @@ {{$contact_action_button}} diff --git a/view/theme/vier/templates/contact_edit.tpl b/view/theme/vier/templates/contact_edit.tpl index 59f8b8f866..82ed71abe2 100644 --- a/view/theme/vier/templates/contact_edit.tpl +++ b/view/theme/vier/templates/contact_edit.tpl @@ -16,6 +16,8 @@ {{$contact_action_button}}