From 05f2cf9202d6f21b21427b8e547a1850a950c277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Mon, 2 Oct 2023 12:00:23 +0200 Subject: [PATCH] fix code because of review --- src/Content/Item.php | 2 - src/Content/Widget/VCard.php | 6 +- src/Model/Contact.php | 12 +-- view/lang/C/messages.po | 101 ++++++++++---------- view/templates/hovercard.tpl | 4 +- view/theme/frio/templates/profile/vcard.tpl | 2 +- view/theme/frio/templates/widget/vcard.tpl | 2 +- 7 files changed, 62 insertions(+), 67 deletions(-) diff --git a/src/Content/Item.php b/src/Content/Item.php index 9e50602df..c94ec1299 100644 --- a/src/Content/Item.php +++ b/src/Content/Item.php @@ -432,8 +432,6 @@ class Item $this->l10n->t('Network Posts') => $posts_link, $this->l10n->t('View Contact') => $contact_url, $this->l10n->t('Send PM') => $pm_url, - $this->l10n->t('Mention') => $mention_url, - $this->l10n->t('Post to group') => $mention_url, $this->l10n->t('Block') => $block_link, $this->l10n->t('Ignore') => $ignore_link, $this->l10n->t('Collapse') => $collapse_link, diff --git a/src/Content/Widget/VCard.php b/src/Content/Widget/VCard.php index d906004c5..478ab52fe 100644 --- a/src/Content/Widget/VCard.php +++ b/src/Content/Widget/VCard.php @@ -101,7 +101,7 @@ class VCard $wallmessage_link = 'message/new/' . $id; } - if (in_array($rel, [Contact::SHARING])) { + if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) { $showgroup_link = 'network/group/' . $id; } } @@ -124,8 +124,8 @@ class VCard '$unfollow_link' => $unfollow_link, '$wallmessage' => DI::l10n()->t('Message'), '$wallmessage_link' => $wallmessage_link, - '$mentioning' => DI::l10n()->t('Mention'), - '$post2group' => DI::l10n()->t('Post to group'), + '$mention' => DI::l10n()->t('Mention'), + '$posttogroup' => DI::l10n()->t('Post to group'), '$showgroup' => DI::l10n()->t('View group'), '$showgroup_link' => $showgroup_link, ]); diff --git a/src/Model/Contact.php b/src/Model/Contact.php index b6a309153..48f201e8c 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1180,7 +1180,6 @@ class Contact $mention_url = ''; $status_link = ''; $photos_link = ''; - $self = false; if (($contact['network'] === Protocol::DFRN) && !$contact['self'] && empty($contact['pending'])) { $profile_link = 'contact/redir/' . $contact['id']; @@ -1199,17 +1198,12 @@ class Contact $pm_url = 'message/new/' . $contact['id']; } - if (in_array($contact['rel'], [contact::SHARING])) { + if ($contact['contact-type'] == Contact::TYPE_COMMUNITY) { $mention_url = 'compose/0?body=!' . $contact['addr']; } else { $mention_url = 'compose/0?body=@' . $contact['addr']; } - - if (in_array($contact['rel'], [contact::SHARING])) { - $self = true; - } - $contact_url = 'contact/' . $contact['id']; $posts_link = 'contact/' . $contact['id'] . '/conversations'; $group_link = 'network/group/' . $contact['id']; @@ -1228,6 +1222,8 @@ class Contact * Menu array: * "name" => [ "Label", "link", (bool)Should the link opened in a new tab? ] */ + + if (empty($contact['uid'])) { $menu = [ 'profile' => [DI::l10n()->t('View Profile'), $profile_link, true], @@ -1250,7 +1246,7 @@ class Contact 'unfollow' => [DI::l10n()->t('Unfollow'), $unfollow_link, true], 'mention' => [DI::l10n()->t('Mention'), DI::l10n()->t('Post to group'), $mention_url, false], 'group' => [DI::l10n()->t('View group'), $group_link, $contact['forum'], true], - 'self' => [$self], + 'self' => [$contact['self'] ?? false, true], ]; if (!empty($contact['pending'])) { diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 833755b2b..5d4dc2f7d 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.09-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-10-02 00:00+0200\n" +"POT-Creation-Date: 2023-10-02 10:20+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1784,46 +1784,35 @@ msgstr "" msgid "Follow Thread" msgstr "" -#: src/Content/Item.php:429 src/Model/Contact.php:1243 +#: src/Content/Item.php:429 src/Model/Contact.php:1239 msgid "View Status" msgstr "" -#: src/Content/Item.php:430 src/Content/Item.php:453 src/Model/Contact.php:1176 -#: src/Model/Contact.php:1233 src/Model/Contact.php:1244 +#: src/Content/Item.php:430 src/Content/Item.php:451 src/Model/Contact.php:1176 +#: src/Model/Contact.php:1229 src/Model/Contact.php:1240 #: 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:1245 +#: src/Content/Item.php:431 src/Model/Contact.php:1241 msgid "View Photos" msgstr "" -#: src/Content/Item.php:432 src/Model/Contact.php:1234 -#: src/Model/Contact.php:1246 +#: src/Content/Item.php:432 src/Model/Contact.php:1230 +#: src/Model/Contact.php:1242 msgid "Network Posts" msgstr "" -#: src/Content/Item.php:433 src/Model/Contact.php:1235 -#: src/Model/Contact.php:1247 +#: src/Content/Item.php:433 src/Model/Contact.php:1231 +#: src/Model/Contact.php:1243 msgid "View Contact" msgstr "" -#: src/Content/Item.php:434 src/Model/Contact.php:1248 +#: src/Content/Item.php:434 src/Model/Contact.php:1244 msgid "Send PM" msgstr "" -#: src/Content/Item.php:435 src/Content/Widget/VCard.php:127 -#: src/Model/Contact.php:1238 src/Model/Contact.php:1251 -#: src/Module/Moderation/Item/Source.php:85 -msgid "Mention" -msgstr "" - -#: src/Content/Item.php:436 src/Content/Widget/VCard.php:128 -#: src/Model/Contact.php:1238 src/Model/Contact.php:1251 -msgid "Post to group" -msgstr "" - -#: src/Content/Item.php:437 src/Module/Contact.php:468 +#: src/Content/Item.php:435 src/Module/Contact.php:468 #: src/Module/Contact/Profile.php:511 #: src/Module/Moderation/Blocklist/Contact.php:116 #: src/Module/Moderation/Users/Active.php:137 @@ -1831,7 +1820,7 @@ msgstr "" msgid "Block" msgstr "" -#: src/Content/Item.php:438 src/Module/Contact.php:469 +#: src/Content/Item.php:436 src/Module/Contact.php:469 #: src/Module/Contact/Profile.php:519 #: src/Module/Notifications/Introductions.php:134 #: src/Module/Notifications/Introductions.php:206 @@ -1839,27 +1828,27 @@ msgstr "" msgid "Ignore" msgstr "" -#: src/Content/Item.php:439 src/Module/Contact.php:470 +#: src/Content/Item.php:437 src/Module/Contact.php:470 #: src/Module/Contact/Profile.php:527 msgid "Collapse" msgstr "" -#: src/Content/Item.php:440 src/Object/Post.php:288 +#: src/Content/Item.php:438 src/Object/Post.php:288 #, php-format msgid "Ignore %s server" msgstr "" -#: src/Content/Item.php:444 src/Object/Post.php:490 +#: src/Content/Item.php:442 src/Object/Post.php:490 msgid "Languages" msgstr "" -#: src/Content/Item.php:450 src/Content/Widget.php:80 -#: src/Model/Contact.php:1236 src/Model/Contact.php:1249 +#: src/Content/Item.php:448 src/Content/Widget.php:80 +#: src/Model/Contact.php:1232 src/Model/Contact.php:1245 #: src/Module/Contact/Follow.php:167 view/theme/vier/theme.php:195 msgid "Connect/Follow" msgstr "" -#: src/Content/Item.php:884 +#: src/Content/Item.php:882 msgid "Unable to fetch user." msgstr "" @@ -2361,7 +2350,7 @@ msgstr "" msgid "Organisations" msgstr "" -#: src/Content/Widget.php:536 src/Model/Contact.php:1717 +#: src/Content/Widget.php:536 src/Model/Contact.php:1713 msgid "News" msgstr "" @@ -2446,14 +2435,24 @@ msgstr "" msgid "Network:" msgstr "" -#: src/Content/Widget/VCard.php:123 src/Model/Contact.php:1237 -#: src/Model/Contact.php:1250 src/Model/Profile.php:463 +#: src/Content/Widget/VCard.php:123 src/Model/Contact.php:1233 +#: src/Model/Contact.php:1246 src/Model/Profile.php:463 #: src/Module/Contact/Profile.php:463 msgid "Unfollow" msgstr "" -#: src/Content/Widget/VCard.php:129 src/Model/Contact.php:1239 -#: src/Model/Contact.php:1252 +#: src/Content/Widget/VCard.php:127 src/Model/Contact.php:1234 +#: src/Model/Contact.php:1247 src/Module/Moderation/Item/Source.php:85 +msgid "Mention" +msgstr "" + +#: src/Content/Widget/VCard.php:128 src/Model/Contact.php:1234 +#: src/Model/Contact.php:1247 +msgid "Post to group" +msgstr "" + +#: src/Content/Widget/VCard.php:129 src/Model/Contact.php:1235 +#: src/Model/Contact.php:1248 msgid "View group" msgstr "" @@ -3205,82 +3204,82 @@ msgstr "" msgid "Edit circles" msgstr "" -#: src/Model/Contact.php:1259 src/Module/Moderation/Users/Pending.php:102 +#: src/Model/Contact.php:1255 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:1713 +#: src/Model/Contact.php:1709 msgid "Organisation" msgstr "" -#: src/Model/Contact.php:1721 +#: src/Model/Contact.php:1717 msgid "Group" msgstr "" -#: src/Model/Contact.php:3024 +#: src/Model/Contact.php:3020 msgid "Disallowed profile URL." msgstr "" -#: src/Model/Contact.php:3029 src/Module/Friendica.php:101 +#: src/Model/Contact.php:3025 src/Module/Friendica.php:101 msgid "Blocked domain" msgstr "" -#: src/Model/Contact.php:3034 +#: src/Model/Contact.php:3030 msgid "Connect URL missing." msgstr "" -#: src/Model/Contact.php:3043 +#: src/Model/Contact.php:3039 msgid "" "The contact could not be added. Please check the relevant network " "credentials in your Settings -> Social Networks page." msgstr "" -#: src/Model/Contact.php:3061 +#: src/Model/Contact.php:3057 #, php-format msgid "Expected network %s does not match actual network %s" msgstr "" -#: src/Model/Contact.php:3078 +#: src/Model/Contact.php:3074 msgid "The profile address specified does not provide adequate information." msgstr "" -#: src/Model/Contact.php:3080 +#: src/Model/Contact.php:3076 msgid "No compatible communication protocols or feeds were discovered." msgstr "" -#: src/Model/Contact.php:3083 +#: src/Model/Contact.php:3079 msgid "An author or name was not found." msgstr "" -#: src/Model/Contact.php:3086 +#: src/Model/Contact.php:3082 msgid "No browser URL could be matched to this address." msgstr "" -#: src/Model/Contact.php:3089 +#: src/Model/Contact.php:3085 msgid "" "Unable to match @-style Identity Address with a known protocol or email " "contact." msgstr "" -#: src/Model/Contact.php:3090 +#: src/Model/Contact.php:3086 msgid "Use mailto: in front of address to force email check." msgstr "" -#: src/Model/Contact.php:3096 +#: src/Model/Contact.php:3092 msgid "" "The profile address specified belongs to a network which has been disabled " "on this site." msgstr "" -#: src/Model/Contact.php:3101 +#: src/Model/Contact.php:3097 msgid "" "Limited profile. This person will be unable to receive direct/personal " "notifications from you." msgstr "" -#: src/Model/Contact.php:3167 +#: src/Model/Contact.php:3163 msgid "Unable to retrieve contact information." msgstr "" diff --git a/view/templates/hovercard.tpl b/view/templates/hovercard.tpl index 41236459a..a7814e566 100644 --- a/view/templates/hovercard.tpl +++ b/view/templates/hovercard.tpl @@ -22,7 +22,9 @@ {{* @todo we have two different photo menus one for contacts and one for items at the network stream. We currently use the contact photo menu, so the items options are missing We need to move them *}}
{{if $profile.actions.pm}}{{$profile.actions.pm.0}}{{/if}} - {{if $profile.addr && !$profile.actions.self}}{{/if}} + + {{if $profile.addr && !$profile.actions.self.0}}{{/if}} +
{{if $profile.actions.group.2==1}}{{/if}} diff --git a/view/theme/frio/templates/profile/vcard.tpl b/view/theme/frio/templates/profile/vcard.tpl index f707e7d6a..94f62bd0d 100644 --- a/view/theme/frio/templates/profile/vcard.tpl +++ b/view/theme/frio/templates/profile/vcard.tpl @@ -74,7 +74,7 @@ {{/if}}
diff --git a/view/theme/frio/templates/widget/vcard.tpl b/view/theme/frio/templates/widget/vcard.tpl index 5266f5be4..e3a8918eb 100644 --- a/view/theme/frio/templates/widget/vcard.tpl +++ b/view/theme/frio/templates/widget/vcard.tpl @@ -60,7 +60,7 @@ {{/if}}