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');
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'] = [

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 2022.12-dev\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\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/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/Profile.php:450
#: src/Module/Contact/Profile.php:468
msgid "Block"
msgstr ""
#: 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:206
#: src/Module/Notifications/Notification.php:89
@ -2458,11 +2458,11 @@ msgstr ""
msgid "Encrypted content"
msgstr ""
#: src/Content/Text/BBCode.php:2089
#: src/Content/Text/BBCode.php:2092
msgid "Invalid source protocol"
msgstr ""
#: src/Content/Text/BBCode.php:2104
#: src/Content/Text/BBCode.php:2107
msgid "Invalid link protocol"
msgstr ""
@ -2475,7 +2475,7 @@ msgid "The end"
msgstr ""
#: 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"
msgstr ""
@ -2677,6 +2677,7 @@ msgstr ""
#: src/Content/Widget/VCard.php:111 src/Model/Contact.php:1195
#: src/Model/Contact.php:1206 src/Model/Profile.php:461
#: src/Module/Contact/Profile.php:420
msgid "Unfollow"
msgstr ""
@ -4221,7 +4222,7 @@ msgstr ""
#: src/Module/Admin/Blocklist/Contact.php:101
#: 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/Profile.php:450
#: src/Module/Contact/Profile.php:468
msgid "Unblock"
msgstr ""
@ -6656,7 +6657,7 @@ msgid "Update"
msgstr ""
#: 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"
msgstr ""
@ -6892,7 +6893,7 @@ msgstr ""
msgid "(Update was successful)"
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"
msgstr ""
@ -6986,7 +6987,7 @@ msgstr ""
msgid "Update public posts"
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"
msgstr ""
@ -7049,23 +7050,23 @@ msgid ""
"entries from this contact."
msgstr ""
#: src/Module/Contact/Profile.php:441
#: src/Module/Contact/Profile.php:459
msgid "Refetch contact data"
msgstr ""
#: src/Module/Contact/Profile.php:452
#: src/Module/Contact/Profile.php:470
msgid "Toggle Blocked status"
msgstr ""
#: src/Module/Contact/Profile.php:460
#: src/Module/Contact/Profile.php:478
msgid "Toggle Ignored status"
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"
msgstr ""
#: src/Module/Contact/Profile.php:469
#: src/Module/Contact/Profile.php:487
msgid "Revoke the follow from this contact"
msgstr ""

View file

@ -15,8 +15,10 @@
<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 $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 $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.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}}
<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>

View 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>

View file

@ -16,8 +16,10 @@
<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 $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 $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.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}}
<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>