Merge pull request #13507 from xundeenergie/finalize-mention-buttons

Finalize mention buttons
This commit is contained in:
Hypolite Petovan 2023-10-07 05:23:19 -04:00 committed by GitHub
commit 8ac6d0ef04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 126 additions and 99 deletions

View File

@ -102,8 +102,15 @@ class VCard
}
if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) {
$showgroup_link = 'network/group/' . $id;
$mention_label = DI::l10n()->t('Post to group');
$mention_url = 'compose/0?body=!' . $contact['addr'];
$showgroup_label = DI::l10n()->t('View group');
$showgroup_url = 'network/group/' . $id;
} else {
$mention_label = DI::l10n()->t('Mention');
$mention_url = 'compose/0?body=@' . $contact['addr'];
}
}
return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/vcard.tpl'), [
@ -124,10 +131,8 @@ class VCard
'$unfollow_link' => $unfollow_link,
'$wallmessage' => DI::l10n()->t('Message'),
'$wallmessage_link' => $wallmessage_link,
'$mention' => DI::l10n()->t('Mention'),
'$posttogroup' => DI::l10n()->t('Post to group'),
'$showgroup' => DI::l10n()->t('View group'),
'$showgroup_link' => $showgroup_link,
'$mention' => [$mention_label, $mention_url],
'$showgroup' => [$showgroup_label, $showgroup_url]
]);
}
}

View File

@ -1198,20 +1198,16 @@ class Contact
$pm_url = 'message/new/' . $contact['id'];
}
if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) {
$mention_label = DI::l10n()->t('Post to group');
$mention_url = 'compose/0?body=!' . $contact['addr'];
} else {
$mention_label = DI::l10n()->t('Mention');
$mention_url = 'compose/0?body=@' . $contact['addr'];
}
$contact_url = 'contact/' . $contact['id'];
if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) {
$mention_label = DI::l10n()->t('Post to group');
$mention_url = 'compose/0?body=!' . $contact['addr'];
$network_label = DI::l10n()->t('View group');
$network_url = 'network/group/' . $contact['id'];
} else {
$mention_label = DI::l10n()->t('Mention');
$mention_url = 'compose/0?body=@' . $contact['addr'];
$network_label = DI::l10n()->t('Network Posts');
$network_url = 'contact/' . $contact['id'] . '/conversations';
}

View File

@ -453,6 +453,18 @@ class Profile
Logger::warning('Missing hidewall key in profile array', ['profile' => $profile, 'callstack' => System::callstack(10)]);
}
if ($profile['account-type'] == Contact::TYPE_COMMUNITY) {
$mention_label = DI::l10n()->t('Post to group');
$mention_url = 'compose/0?body=!' . $profile['addr'];
$network_label = DI::l10n()->t('View group');
$network_url = 'network/group/' . $profile['id'];
} else {
$mention_label = DI::l10n()->t('Mention');
$mention_url = 'compose/0?body=@' . $profile['addr'];
$network_label = DI::l10n()->t('Network Posts');
$network_url = 'contact/' . $profile['id'] . '/conversations';
}
$tpl = Renderer::getMarkupTemplate('profile/vcard.tpl');
$o .= Renderer::replaceMacros($tpl, [
'$profile' => $p,
@ -476,6 +488,10 @@ class Profile
'$updated' => $updated,
'$diaspora' => $diaspora,
'$contact_block' => $contact_block,
'$mention_label' => $mention_label,
'$mention_url' => $mention_url,
'$network_label' => $network_label,
'$network_url' => $network_url,
]);
$arr = ['profile' => &$profile, 'entry' => &$o];

View File

@ -1380,8 +1380,8 @@ msgstr ""
msgid "Public post"
msgstr ""
#: src/Content/Conversation.php:424 src/Content/Widget/VCard.php:125
#: src/Model/Profile.php:467 src/Module/Admin/Logs/View.php:92
#: src/Content/Conversation.php:424 src/Content/Widget/VCard.php:132
#: src/Model/Profile.php:479 src/Module/Admin/Logs/View.php:92
#: src/Module/Post/Edit.php:181
msgid "Message"
msgstr ""
@ -1791,30 +1791,31 @@ msgstr ""
msgid "Follow Thread"
msgstr ""
#: src/Content/Item.php:429 src/Model/Contact.php:1246
#: src/Content/Item.php:429 src/Model/Contact.php:1242
msgid "View Status"
msgstr ""
#: src/Content/Item.php:430 src/Content/Item.php:451 src/Model/Contact.php:1176
#: src/Model/Contact.php:1237 src/Model/Contact.php:1247
#: src/Model/Contact.php:1233 src/Model/Contact.php:1243
#: src/Module/Directory.php:157 src/Module/Settings/Profile/Index.php:259
msgid "View Profile"
msgstr ""
#: src/Content/Item.php:431 src/Model/Contact.php:1248
#: src/Content/Item.php:431 src/Model/Contact.php:1244
msgid "View Photos"
msgstr ""
#: src/Content/Item.php:432 src/Model/Contact.php:1215
#: src/Content/Item.php:432 src/Model/Contact.php:1211
#: src/Model/Profile.php:464
msgid "Network Posts"
msgstr ""
#: src/Content/Item.php:433 src/Model/Contact.php:1239
#: src/Model/Contact.php:1250
#: src/Content/Item.php:433 src/Model/Contact.php:1235
#: src/Model/Contact.php:1246
msgid "View Contact"
msgstr ""
#: src/Content/Item.php:434 src/Model/Contact.php:1251
#: src/Content/Item.php:434 src/Model/Contact.php:1247
msgid "Send PM"
msgstr ""
@ -1849,7 +1850,7 @@ msgid "Languages"
msgstr ""
#: src/Content/Item.php:448 src/Content/Widget.php:80
#: src/Model/Contact.php:1240 src/Model/Contact.php:1252
#: src/Model/Contact.php:1236 src/Model/Contact.php:1248
#: src/Module/Contact/Follow.php:167 view/theme/vier/theme.php:195
msgid "Connect/Follow"
msgstr ""
@ -2220,8 +2221,8 @@ msgstr ""
msgid "The end"
msgstr ""
#: src/Content/Text/HTML.php:859 src/Content/Widget/VCard.php:121
#: src/Model/Profile.php:461 src/Module/Contact/Profile.php:471
#: src/Content/Text/HTML.php:859 src/Content/Widget/VCard.php:128
#: src/Model/Profile.php:473 src/Module/Contact/Profile.php:471
msgid "Follow"
msgstr ""
@ -2356,7 +2357,7 @@ msgstr ""
msgid "Organisations"
msgstr ""
#: src/Content/Widget.php:536 src/Model/Contact.php:1718
#: src/Content/Widget.php:536 src/Model/Contact.php:1714
msgid "News"
msgstr ""
@ -2419,17 +2420,32 @@ msgstr[1] ""
msgid "More Trending Tags"
msgstr ""
#: src/Content/Widget/VCard.php:114 src/Model/Profile.php:376
#: src/Content/Widget/VCard.php:105 src/Model/Contact.php:1204
#: src/Model/Profile.php:457
msgid "Post to group"
msgstr ""
#: src/Content/Widget/VCard.php:107 src/Model/Contact.php:1206
#: src/Model/Profile.php:459
msgid "View group"
msgstr ""
#: src/Content/Widget/VCard.php:110 src/Model/Contact.php:1209
#: src/Model/Profile.php:462 src/Module/Moderation/Item/Source.php:85
msgid "Mention"
msgstr ""
#: src/Content/Widget/VCard.php:121 src/Model/Profile.php:376
#: src/Module/Contact/Profile.php:408 src/Module/Profile/Profile.php:199
msgid "XMPP:"
msgstr ""
#: src/Content/Widget/VCard.php:115 src/Model/Profile.php:377
#: src/Content/Widget/VCard.php:122 src/Model/Profile.php:377
#: src/Module/Contact/Profile.php:410 src/Module/Profile/Profile.php:203
msgid "Matrix:"
msgstr ""
#: src/Content/Widget/VCard.php:116 src/Model/Event.php:82
#: src/Content/Widget/VCard.php:123 src/Model/Event.php:82
#: src/Model/Event.php:109 src/Model/Event.php:471 src/Model/Event.php:963
#: src/Model/Profile.php:371 src/Module/Contact/Profile.php:406
#: src/Module/Directory.php:147 src/Module/Notifications/Introductions.php:187
@ -2437,30 +2453,17 @@ msgstr ""
msgid "Location:"
msgstr ""
#: src/Content/Widget/VCard.php:119 src/Model/Profile.php:474
#: src/Content/Widget/VCard.php:126 src/Model/Profile.php:486
#: src/Module/Notifications/Introductions.php:201
msgid "Network:"
msgstr ""
#: src/Content/Widget/VCard.php:123 src/Model/Contact.php:1241
#: src/Model/Contact.php:1253 src/Model/Profile.php:463
#: src/Content/Widget/VCard.php:130 src/Model/Contact.php:1237
#: src/Model/Contact.php:1249 src/Model/Profile.php:475
#: src/Module/Contact/Profile.php:463
msgid "Unfollow"
msgstr ""
#: src/Content/Widget/VCard.php:127 src/Model/Contact.php:1205
#: src/Module/Moderation/Item/Source.php:85
msgid "Mention"
msgstr ""
#: src/Content/Widget/VCard.php:128 src/Model/Contact.php:1202
msgid "Post to group"
msgstr ""
#: src/Content/Widget/VCard.php:129 src/Model/Contact.php:1212
msgid "View group"
msgstr ""
#: src/Core/ACL.php:166 src/Module/Profile/Profile.php:269
msgid "Yourself"
msgstr ""
@ -3209,82 +3212,82 @@ msgstr ""
msgid "Edit circles"
msgstr ""
#: src/Model/Contact.php:1260 src/Module/Moderation/Users/Pending.php:102
#: src/Model/Contact.php:1256 src/Module/Moderation/Users/Pending.php:102
#: src/Module/Notifications/Introductions.php:132
#: src/Module/Notifications/Introductions.php:204
msgid "Approve"
msgstr ""
#: src/Model/Contact.php:1714
#: src/Model/Contact.php:1710
msgid "Organisation"
msgstr ""
#: src/Model/Contact.php:1722
#: src/Model/Contact.php:1718
msgid "Group"
msgstr ""
#: src/Model/Contact.php:3025
#: src/Model/Contact.php:3021
msgid "Disallowed profile URL."
msgstr ""
#: src/Model/Contact.php:3030 src/Module/Friendica.php:101
#: src/Model/Contact.php:3026 src/Module/Friendica.php:101
msgid "Blocked domain"
msgstr ""
#: src/Model/Contact.php:3035
#: src/Model/Contact.php:3031
msgid "Connect URL missing."
msgstr ""
#: src/Model/Contact.php:3044
#: src/Model/Contact.php:3040
msgid ""
"The contact could not be added. Please check the relevant network "
"credentials in your Settings -> Social Networks page."
msgstr ""
#: src/Model/Contact.php:3062
#: src/Model/Contact.php:3058
#, php-format
msgid "Expected network %s does not match actual network %s"
msgstr ""
#: src/Model/Contact.php:3079
#: src/Model/Contact.php:3075
msgid "The profile address specified does not provide adequate information."
msgstr ""
#: src/Model/Contact.php:3081
#: src/Model/Contact.php:3077
msgid "No compatible communication protocols or feeds were discovered."
msgstr ""
#: src/Model/Contact.php:3084
#: src/Model/Contact.php:3080
msgid "An author or name was not found."
msgstr ""
#: src/Model/Contact.php:3087
#: src/Model/Contact.php:3083
msgid "No browser URL could be matched to this address."
msgstr ""
#: src/Model/Contact.php:3090
#: src/Model/Contact.php:3086
msgid ""
"Unable to match @-style Identity Address with a known protocol or email "
"contact."
msgstr ""
#: src/Model/Contact.php:3091
#: src/Model/Contact.php:3087
msgid "Use mailto: in front of address to force email check."
msgstr ""
#: src/Model/Contact.php:3097
#: src/Model/Contact.php:3093
msgid ""
"The profile address specified belongs to a network which has been disabled "
"on this site."
msgstr ""
#: src/Model/Contact.php:3102
#: src/Model/Contact.php:3098
msgid ""
"Limited profile. This person will be unable to receive direct/personal "
"notifications from you."
msgstr ""
#: src/Model/Contact.php:3168
#: src/Model/Contact.php:3164
msgid "Unable to retrieve contact information."
msgstr ""
@ -3494,130 +3497,130 @@ msgstr ""
msgid "About:"
msgstr ""
#: src/Model/Profile.php:465
#: src/Model/Profile.php:477
msgid "Atom feed"
msgstr ""
#: src/Model/Profile.php:472
#: src/Model/Profile.php:484
msgid "This website has been verified to belong to the same person."
msgstr ""
#: src/Model/Profile.php:509
#: src/Model/Profile.php:525
msgid "F d"
msgstr ""
#: src/Model/Profile.php:573 src/Model/Profile.php:662
#: src/Model/Profile.php:589 src/Model/Profile.php:678
msgid "[today]"
msgstr ""
#: src/Model/Profile.php:582
#: src/Model/Profile.php:598
msgid "Birthday Reminders"
msgstr ""
#: src/Model/Profile.php:583
#: src/Model/Profile.php:599
msgid "Birthdays this week:"
msgstr ""
#: src/Model/Profile.php:611
#: src/Model/Profile.php:627
msgid "g A l F d"
msgstr ""
#: src/Model/Profile.php:649
#: src/Model/Profile.php:665
msgid "[No description]"
msgstr ""
#: src/Model/Profile.php:675
#: src/Model/Profile.php:691
msgid "Event Reminders"
msgstr ""
#: src/Model/Profile.php:676
#: src/Model/Profile.php:692
msgid "Upcoming events the next 7 days:"
msgstr ""
#: src/Model/Profile.php:875
#: src/Model/Profile.php:891
#, php-format
msgid "OpenWebAuth: %1$s welcomes %2$s"
msgstr ""
#: src/Model/Profile.php:1015
#: src/Model/Profile.php:1031
msgid "Hometown:"
msgstr ""
#: src/Model/Profile.php:1016
#: src/Model/Profile.php:1032
msgid "Marital Status:"
msgstr ""
#: src/Model/Profile.php:1017
#: src/Model/Profile.php:1033
msgid "With:"
msgstr ""
#: src/Model/Profile.php:1018
#: src/Model/Profile.php:1034
msgid "Since:"
msgstr ""
#: src/Model/Profile.php:1019
#: src/Model/Profile.php:1035
msgid "Sexual Preference:"
msgstr ""
#: src/Model/Profile.php:1020
#: src/Model/Profile.php:1036
msgid "Political Views:"
msgstr ""
#: src/Model/Profile.php:1021
#: src/Model/Profile.php:1037
msgid "Religious Views:"
msgstr ""
#: src/Model/Profile.php:1022
#: src/Model/Profile.php:1038
msgid "Likes:"
msgstr ""
#: src/Model/Profile.php:1023
#: src/Model/Profile.php:1039
msgid "Dislikes:"
msgstr ""
#: src/Model/Profile.php:1024
#: src/Model/Profile.php:1040
msgid "Title/Description:"
msgstr ""
#: src/Model/Profile.php:1025 src/Module/Admin/Summary.php:197
#: src/Model/Profile.php:1041 src/Module/Admin/Summary.php:197
#: src/Module/Moderation/Report/Create.php:280
#: src/Module/Moderation/Summary.php:77
msgid "Summary"
msgstr ""
#: src/Model/Profile.php:1026
#: src/Model/Profile.php:1042
msgid "Musical interests"
msgstr ""
#: src/Model/Profile.php:1027
#: src/Model/Profile.php:1043
msgid "Books, literature"
msgstr ""
#: src/Model/Profile.php:1028
#: src/Model/Profile.php:1044
msgid "Television"
msgstr ""
#: src/Model/Profile.php:1029
#: src/Model/Profile.php:1045
msgid "Film/dance/culture/entertainment"
msgstr ""
#: src/Model/Profile.php:1030
#: src/Model/Profile.php:1046
msgid "Hobbies/Interests"
msgstr ""
#: src/Model/Profile.php:1031
#: src/Model/Profile.php:1047
msgid "Love/romance"
msgstr ""
#: src/Model/Profile.php:1032
#: src/Model/Profile.php:1048
msgid "Work/employment"
msgstr ""
#: src/Model/Profile.php:1033
#: src/Model/Profile.php:1049
msgid "School/education"
msgstr ""
#: src/Model/Profile.php:1034
#: src/Model/Profile.php:1050
msgid "Contact information and Social Networks"
msgstr ""

View File

@ -72,9 +72,16 @@
{{/if}}
{{if $profile.addr}}
<div id="mention-link-button">
<button type="button" id="mention-link" class="btn btn-labeled btn-primary" onclick="openWallMessage('compose/0?body={{if $profile.forum==1}}!{{else}}@{{/if}}{{$profile.addr}}')">
<button type="button" id="mention-link" class="btn btn-labeled btn-primary" onclick="openWallMessage('{{$mention_url}}')">
<span class=""><i class="fa fa-pencil-square-o"></i></span>
<span class="">{{$mention}}</span>
<span class="">{{$mention_label}}</span>
</div>
{{/if}}
{{if $network_label}}
<div id="showgroup-button">
<button type="button" id="showgroup" class="btn btn-labeled btn-primary" onclick="window.location.href=('{{$network_url}}')">
<span class=""><i class="fa fa-group"></i></span>
<span class="">{{$network_label}}</span>
</div>
{{/if}}
</div>

View File

@ -58,17 +58,17 @@
{{/if}}
{{if $contact.addr}}
<div id="mention-link-button">
<button type="button" id="mention-link" class="btn btn-labeled btn-primary{{if !$always_open_compose}} modal-open{{/if}}" onclick="openWallMessage('compose/0?body={{if $contact.forum==1}}!{{else}}@{{/if}}{{$contact.addr}}')">
<button type="button" id="mention-link" class="btn btn-labeled btn-primary{{if !$always_open_compose}} modal-open{{/if}}" onclick="openWallMessage('{{$mention.1}}')" titel="{{$mention.0}}" aria-label="{{$mention.0}}">
<span class=""><i class="fa fa-pencil-square-o"></i></span>
<span class="">{{if $contact.forum==1}}{{$posttogroup}}{{else}}{{$mention}}{{/if}}</span>
<span class="">{{$mention.0}}</span>
</button>
</div>
{{/if}}
{{if $contact.forum==1 || $contact.prv==1}}
<div id="show-group-button">
<button type="button" id="show-group" class="btn btn-labeled btn-primary{{if !$always_open_compose}} modal-open{{/if}}" onclick="window.location.href='{{$showgroup_link}}'">
<button type="button" id="show-group" class="btn btn-labeled btn-primary{{if !$always_open_compose}} modal-open{{/if}}" onclick="window.location.href='{{$showgroup.1}}'">
<span class=""><i class="fa fa-group"></i></span>
<span class="">{{$showgroup}}</span>
<span class="">{{$showgroup.0}}</span>
</button>
</div>
{{/if}}