Merge pull request #12118 from MrPetovan/task/10875-add-follow-contact-actions

Add follow/unfollow link to the contact actions menu
This commit is contained in:
Michael Vogel 2022-11-07 08:41:15 +01:00 committed by GitHub
commit 029a539774
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 20 deletions

View file

@ -415,6 +415,24 @@ class Profile extends BaseModule
$formSecurityToken = self::getFormSecurityToken('contact_action'); $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 // Provide friend suggestion only for Friendica contacts
if ($contact['network'] === Protocol::DFRN) { if ($contact['network'] === Protocol::DFRN) {
$contact_actions['suggest'] = [ $contact_actions['suggest'] = [

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2022.12-dev\n" "Project-Id-Version: 2022.12-dev\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-05 17:58-0400\n" "POT-Creation-Date: 2022-11-05 19:31-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -2127,12 +2127,12 @@ msgstr ""
#: src/Content/Item.php:394 src/Module/Admin/Blocklist/Contact.php:100 #: src/Content/Item.php:394 src/Module/Admin/Blocklist/Contact.php:100
#: src/Module/Admin/Users/Active.php:140 src/Module/Admin/Users/Index.php:154 #: src/Module/Admin/Users/Active.php:140 src/Module/Admin/Users/Index.php:154
#: src/Module/Contact.php:401 src/Module/Contact/Profile.php:349 #: src/Module/Contact.php:401 src/Module/Contact/Profile.php:349
#: src/Module/Contact/Profile.php:450 #: src/Module/Contact/Profile.php:468
msgid "Block" msgid "Block"
msgstr "" msgstr ""
#: src/Content/Item.php:395 src/Module/Contact.php:402 #: src/Content/Item.php:395 src/Module/Contact.php:402
#: src/Module/Contact/Profile.php:350 src/Module/Contact/Profile.php:458 #: src/Module/Contact/Profile.php:350 src/Module/Contact/Profile.php:476
#: src/Module/Notifications/Introductions.php:134 #: src/Module/Notifications/Introductions.php:134
#: src/Module/Notifications/Introductions.php:206 #: src/Module/Notifications/Introductions.php:206
#: src/Module/Notifications/Notification.php:89 #: src/Module/Notifications/Notification.php:89
@ -2458,11 +2458,11 @@ msgstr ""
msgid "Encrypted content" msgid "Encrypted content"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:2089 #: src/Content/Text/BBCode.php:2092
msgid "Invalid source protocol" msgid "Invalid source protocol"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:2104 #: src/Content/Text/BBCode.php:2107
msgid "Invalid link protocol" msgid "Invalid link protocol"
msgstr "" msgstr ""
@ -2475,7 +2475,7 @@ msgid "The end"
msgstr "" msgstr ""
#: src/Content/Text/HTML.php:882 src/Content/Widget/VCard.php:109 #: src/Content/Text/HTML.php:882 src/Content/Widget/VCard.php:109
#: src/Model/Profile.php:459 #: src/Model/Profile.php:459 src/Module/Contact/Profile.php:428
msgid "Follow" msgid "Follow"
msgstr "" msgstr ""
@ -2677,6 +2677,7 @@ msgstr ""
#: src/Content/Widget/VCard.php:111 src/Model/Contact.php:1195 #: src/Content/Widget/VCard.php:111 src/Model/Contact.php:1195
#: src/Model/Contact.php:1206 src/Model/Profile.php:461 #: src/Model/Contact.php:1206 src/Model/Profile.php:461
#: src/Module/Contact/Profile.php:420
msgid "Unfollow" msgid "Unfollow"
msgstr "" msgstr ""
@ -4221,7 +4222,7 @@ msgstr ""
#: src/Module/Admin/Blocklist/Contact.php:101 #: src/Module/Admin/Blocklist/Contact.php:101
#: src/Module/Admin/Users/Blocked.php:142 src/Module/Admin/Users/Index.php:156 #: src/Module/Admin/Users/Blocked.php:142 src/Module/Admin/Users/Index.php:156
#: src/Module/Contact.php:401 src/Module/Contact/Profile.php:349 #: src/Module/Contact.php:401 src/Module/Contact/Profile.php:349
#: src/Module/Contact/Profile.php:450 #: src/Module/Contact/Profile.php:468
msgid "Unblock" msgid "Unblock"
msgstr "" msgstr ""
@ -6656,7 +6657,7 @@ msgid "Update"
msgstr "" msgstr ""
#: src/Module/Contact.php:402 src/Module/Contact/Profile.php:350 #: src/Module/Contact.php:402 src/Module/Contact/Profile.php:350
#: src/Module/Contact/Profile.php:458 #: src/Module/Contact/Profile.php:476
msgid "Unignore" msgid "Unignore"
msgstr "" msgstr ""
@ -6892,7 +6893,7 @@ msgstr ""
msgid "(Update was successful)" msgid "(Update was successful)"
msgstr "" msgstr ""
#: src/Module/Contact/Profile.php:255 src/Module/Contact/Profile.php:421 #: src/Module/Contact/Profile.php:255 src/Module/Contact/Profile.php:439
msgid "Suggest friends" msgid "Suggest friends"
msgstr "" msgstr ""
@ -6986,7 +6987,7 @@ msgstr ""
msgid "Update public posts" msgid "Update public posts"
msgstr "" msgstr ""
#: src/Module/Contact/Profile.php:347 src/Module/Contact/Profile.php:431 #: src/Module/Contact/Profile.php:347 src/Module/Contact/Profile.php:449
msgid "Update now" msgid "Update now"
msgstr "" msgstr ""
@ -7049,23 +7050,23 @@ msgid ""
"entries from this contact." "entries from this contact."
msgstr "" msgstr ""
#: src/Module/Contact/Profile.php:441 #: src/Module/Contact/Profile.php:459
msgid "Refetch contact data" msgid "Refetch contact data"
msgstr "" msgstr ""
#: src/Module/Contact/Profile.php:452 #: src/Module/Contact/Profile.php:470
msgid "Toggle Blocked status" msgid "Toggle Blocked status"
msgstr "" msgstr ""
#: src/Module/Contact/Profile.php:460 #: src/Module/Contact/Profile.php:478
msgid "Toggle Ignored status" msgid "Toggle Ignored status"
msgstr "" msgstr ""
#: src/Module/Contact/Profile.php:467 src/Module/Contact/Revoke.php:106 #: src/Module/Contact/Profile.php:485 src/Module/Contact/Revoke.php:106
msgid "Revoke Follow" msgid "Revoke Follow"
msgstr "" msgstr ""
#: src/Module/Contact/Profile.php:469 #: src/Module/Contact/Profile.php:487
msgid "Revoke the follow from this contact" msgid "Revoke the follow from this contact"
msgstr "" msgstr ""

View file

@ -15,8 +15,10 @@
<a class="btn" rel="#contact-actions-menu" href="#" id="contact-edit-actions-button">{{$contact_action_button}}</a> <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"> <ul role="menu" aria-haspopup="true" id="contact-actions-menu" class="menu-popup">
{{if $lblsuggest}}<li role="menuitem"><a href="#" title="{{$contact_actions.suggest.title}}" onclick="window.location.href='{{$contact_actions.suggest.url}}'; return false;">{{$contact_actions.suggest.label}}</a></li>{{/if}} {{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 $poll_enabled}}<li role="menuitem"><a href="#" title="{{$contact_actions.update.title}}" onclick="window.location.href='{{$contact_actions.update.url}}'; return false;">{{$contact_actions.update.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}} {{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}}
<li class="divider"></li> <li class="divider"></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.block.title}}" onclick="window.location.href='{{$contact_actions.block.url}}'; return false;">{{$contact_actions.block.label}}</a></li> <li role="menuitem"><a href="#" title="{{$contact_actions.block.title}}" onclick="window.location.href='{{$contact_actions.block.url}}'; return false;">{{$contact_actions.block.label}}</a></li>

View file

@ -19,6 +19,8 @@
</button> </button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="contact-edit-actions-button" aria-haspopup="true" id="contact-actions-menu"> <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 $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 $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}} {{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}}

View file

@ -16,8 +16,10 @@
<a class="btn" id="contact-edit-actions-button">{{$contact_action_button}}</a> <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"> <ul role="menu" aria-haspopup="true" id="contact-actions-menu" class="menu-popup">
{{if $lblsuggest}}<li role="menuitem"><a href="#" title="{{$contact_actions.suggest.title}}" onclick="window.location.href='{{$contact_actions.suggest.url}}'; return false;">{{$contact_actions.suggest.label}}</a></li>{{/if}} {{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 $poll_enabled}}<li role="menuitem"><a href="#" title="{{$contact_actions.update.title}}" onclick="window.location.href='{{$contact_actions.update.url}}'; return false;">{{$contact_actions.update.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}} {{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}}
<li class="divider"></li> <li class="divider"></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.block.title}}" onclick="window.location.href='{{$contact_actions.block.url}}'; return false;">{{$contact_actions.block.label}}</a></li> <li role="menuitem"><a href="#" title="{{$contact_actions.block.title}}" onclick="window.location.href='{{$contact_actions.block.url}}'; return false;">{{$contact_actions.block.label}}</a></li>