]> git.mxchange.org Git - friendica.git/commitdiff
Add follow/unfollow link to the contact actions menu
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 5 Nov 2022 22:15:25 +0000 (18:15 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 7 Nov 2022 00:03:21 +0000 (19:03 -0500)
src/Module/Contact/Profile.php
view/templates/contact_edit.tpl
view/theme/frio/templates/contact_edit.tpl
view/theme/vier/templates/contact_edit.tpl

index ec1c6b55bc6e17091278009701b967f92bab21b7..eaf9993fc1704f97a688addcca7945eba207c01a 100644 (file)
@@ -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'] = [
index 90b163cb0f37a499290d57414ec5ce9f7f0b5061..2b84657c88003828d65c0cfc03d0efabe85c3ff6 100644 (file)
@@ -15,6 +15,8 @@
                                                <a class="btn" rel="#contact-actions-menu" href="#" id="contact-edit-actions-button">{{$contact_action_button}}</a>
 
                                                <ul role="menu" aria-haspopup="true" id="contact-actions-menu" class="menu-popup">
+                                                       {{if $contact_actions.follow}}<li role="menuitem"><a href="{{$contact_actions.follow.url}}" title="{{$contact_actions.follow.title}}">{{$contact_actions.follow.label}}</a></li>{{/if}}
+                                                       {{if $contact_actions.unfollow}}<li role="menuitem"><a href="{{$contact_actions.unfollow.url}}" title="{{$contact_actions.unfollow.title}}">{{$contact_actions.unfollow.label}}</a></li>{{/if}}
                                                        {{if $lblsuggest}}<li role="menuitem"><a href="{{$contact_actions.suggest.url}}" title="{{$contact_actions.suggest.title}}">{{$contact_actions.suggest.label}}</a></li>{{/if}}
                                                        {{if $poll_enabled}}<li role="menuitem"><a href="{{$contact_actions.update.url}}" title="{{$contact_actions.update.title}}">{{$contact_actions.update.label}}</a></li>{{/if}}
                                                        {{if $contact_actions.updateprofile}}<li role="menuitem"><a href="{{$contact_actions.updateprofile.url}}" title="{{$contact_actions.updateprofile.title}}">{{$contact_actions.updateprofile.label}}</a></li>{{/if}}
index 3457be6997650bf5ccb1f13fb0065804d8a0cdbe..693434cc8256dea5848923e4270b2e3e30db0deb 100644 (file)
@@ -19,6 +19,8 @@
                                                </button>
 
                                                <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="contact-edit-actions-button" aria-haspopup="true" id="contact-actions-menu">
+                                                       {{if $contact_actions.follow}}<li role="presentation"><a role="menuitem" href="{{$contact_actions.follow.url}}" title="{{$contact_actions.follow.title}}">{{$contact_actions.follow.label}}</a></li>{{/if}}
+                                                       {{if $contact_actions.unfollow}}<li role="presentation"><a role="menuitem" href="{{$contact_actions.unfollow.url}}" title="{{$contact_actions.unfollow.title}}">{{$contact_actions.unfollow.label}}</a></li>{{/if}}
                                                        {{if $lblsuggest}}<li role="presentation"><a role="menuitem" href="{{$contact_actions.suggest.url}}" title="{{$contact_actions.suggest.title}}">{{$contact_actions.suggest.label}}</a></li>{{/if}}
                                                        {{if $poll_enabled}}<li role="presentation"><a role="menuitem" href="{{$contact_actions.update.url}}" title="{{$contact_actions.update.title}}">{{$contact_actions.update.label}}</a></li>{{/if}}
                                                        {{if $contact_actions.updateprofile}}<li role="presentation"><a role="menuitem" href="{{$contact_actions.updateprofile.url}}" title="{{$contact_actions.updateprofile.title}}">{{$contact_actions.updateprofile.label}}</a></li>{{/if}}
@@ -27,7 +29,7 @@
                                                        {{/if}}
                                                        <li role="presentation"><a role="menuitem" href="{{$contact_actions.block.url}}" title="{{$contact_actions.block.title}}">{{$contact_actions.block.label}}</a></li>
                                                        <li role="presentation"><a role="menuitem" href="{{$contact_actions.ignore.url}}" title="{{$contact_actions.ignore.title}}">{{$contact_actions.ignore.label}}</a></li>
-                            {{if $contact_actions.revoke_follow.url}}<li role="presentation"><button role="menuitem" type="button" class="btn-link" title="{{$contact_actions.revoke_follow.title}}" onclick="addToModal('{{$contact_actions.revoke_follow.url}}');">{{$contact_actions.revoke_follow.label}}</button></li>{{/if}}
+                                                       {{if $contact_actions.revoke_follow.url}}<li role="presentation"><button role="menuitem" type="button" class="btn-link" title="{{$contact_actions.revoke_follow.title}}" onclick="addToModal('{{$contact_actions.revoke_follow.url}}');">{{$contact_actions.revoke_follow.label}}</button></li>{{/if}}
                                                </ul>
                                        </li>
                                </ul>
index 59f8b8f86698e50eda7efc599fe7dff791be9354..82ed71abe2f891df82f4e8077c09c92c5e38070b 100644 (file)
@@ -16,6 +16,8 @@
                                                <a class="btn" id="contact-edit-actions-button">{{$contact_action_button}}</a>
 
                                                <ul role="menu" aria-haspopup="true" id="contact-actions-menu" class="menu-popup">
+                                                       {{if $contact_actions.follow}}<li role="menuitem"><a href="{{$contact_actions.follow.url}}" title="{{$contact_actions.follow.title}}">{{$contact_actions.follow.label}}</a></li>{{/if}}
+                                                       {{if $contact_actions.unfollow}}<li role="menuitem"><a href="{{$contact_actions.unfollow.url}}" title="{{$contact_actions.unfollow.title}}">{{$contact_actions.unfollow.label}}</a></li>{{/if}}
                                                        {{if $lblsuggest}}<li role="menuitem"><a href="{{$contact_actions.suggest.url}}" title="{{$contact_actions.suggest.title}}">{{$contact_actions.suggest.label}}</a></li>{{/if}}
                                                        {{if $poll_enabled}}<li role="menuitem"><a href="{{$contact_actions.update.url}}" title="{{$contact_actions.update.title}}">{{$contact_actions.update.label}}</a></li>{{/if}}
                                                        {{if $contact_actions.updateprofile}}<li role="menuitem"><a href="{{$contact_actions.updateprofile.url}}" title="{{$contact_actions.updateprofile.title}}">{{$contact_actions.updateprofile.label}}</a></li>{{/if}}