From 9f2d2d4ac17bf8c6d6761251a04c5a12bc41fad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz=20=28admin=29?= Date: Sun, 1 Oct 2023 12:38:57 +0200 Subject: [PATCH 1/8] add mention-buttons --- view/templates/hovercard.tpl | 1 + view/theme/frio/templates/profile/vcard.tpl | 7 +++++++ view/theme/frio/templates/widget/vcard.tpl | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/view/templates/hovercard.tpl b/view/templates/hovercard.tpl index 563a5a248..ff3b3101a 100644 --- a/view/templates/hovercard.tpl +++ b/view/templates/hovercard.tpl @@ -24,6 +24,7 @@ {{if $profile.actions.pm}}{{$profile.actions.pm.0}}{{/if}}
+ {{if $profile.addr}}{{/if}} {{if $profile.actions.network}}{{/if}} {{if $profile.actions.edit}}{{/if}} {{if $profile.actions.follow}}{{/if}} diff --git a/view/theme/frio/templates/profile/vcard.tpl b/view/theme/frio/templates/profile/vcard.tpl index cc67227a2..f707e7d6a 100644 --- a/view/theme/frio/templates/profile/vcard.tpl +++ b/view/theme/frio/templates/profile/vcard.tpl @@ -70,6 +70,13 @@
{{/if}} + {{if $profile.addr}} + + {{/if}} {{/if}} diff --git a/view/theme/frio/templates/widget/vcard.tpl b/view/theme/frio/templates/widget/vcard.tpl index 9fef57a9d..378693938 100644 --- a/view/theme/frio/templates/widget/vcard.tpl +++ b/view/theme/frio/templates/widget/vcard.tpl @@ -56,6 +56,14 @@ {{/if}} + {{if $contact.addr}} + + {{/if}}
From ed9d20b2914b27312b3c57148da95ae5257213fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz=20=28admin=29?= Date: Sun, 1 Oct 2023 12:53:06 +0200 Subject: [PATCH 2/8] Change label of mention-button * "Mention" on users profile * "Post to group" on group/forums profile --- src/Content/Widget/VCard.php | 5 +++++ view/theme/frio/templates/widget/vcard.tpl | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Content/Widget/VCard.php b/src/Content/Widget/VCard.php index 62a8e9085..32eb95e43 100644 --- a/src/Content/Widget/VCard.php +++ b/src/Content/Widget/VCard.php @@ -68,6 +68,7 @@ class VCard $follow_link = ''; $unfollow_link = ''; $wallmessage_link = ''; + $showforum_link = ''; $photo = Contact::getPhoto($contact); @@ -119,6 +120,10 @@ class VCard '$unfollow_link' => $unfollow_link, '$wallmessage' => DI::l10n()->t('Message'), '$wallmessage_link' => $wallmessage_link, + '$showforum' => DI::l10n()->t('Show forum'), + '$showforum_link' => $showforum_link, + '$mentioning' => DI::l10n()->t('Mention'), + '$post2group' => DI::l10n()->t('Post to group'), ]); } } diff --git a/view/theme/frio/templates/widget/vcard.tpl b/view/theme/frio/templates/widget/vcard.tpl index 378693938..ecc47bea2 100644 --- a/view/theme/frio/templates/widget/vcard.tpl +++ b/view/theme/frio/templates/widget/vcard.tpl @@ -60,7 +60,7 @@ {{/if}} From 9dfe39b83dd181590fe9ff59c11b69710d2f8d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz=20=28admin=29?= Date: Sun, 1 Oct 2023 14:03:03 +0200 Subject: [PATCH 3/8] set label in hovercard for mentionings --- src/Content/Item.php | 2 ++ src/Model/Contact.php | 4 ++++ view/templates/hovercard.tpl | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Content/Item.php b/src/Content/Item.php index c94ec1299..9e50602df 100644 --- a/src/Content/Item.php +++ b/src/Content/Item.php @@ -432,6 +432,8 @@ 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/Model/Contact.php b/src/Model/Contact.php index 243b48ad1..a8ee93686 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1177,6 +1177,7 @@ class Contact } $pm_url = ''; + $mention_url = ''; $status_link = ''; $photos_link = ''; @@ -1197,6 +1198,7 @@ class Contact $pm_url = 'message/new/' . $contact['id']; } + $mention_url = 'compose/0?body=@' . $contact['addr']; $contact_url = 'contact/' . $contact['id']; $posts_link = 'contact/' . $contact['id'] . '/conversations'; @@ -1230,8 +1232,10 @@ class Contact 'network' => [DI::l10n()->t('Network Posts'), $posts_link, false], 'edit' => [DI::l10n()->t('View Contact'), $contact_url, false], 'pm' => [DI::l10n()->t('Send PM'), $pm_url, false], + 'mention' => [DI::l10n()->t('Mention'), DI::l10n()->t('Post to group'), $mention_url, false], 'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link, true], 'unfollow' => [DI::l10n()->t('Unfollow'), $unfollow_link, true], + 'isgroup' => [$contact['forum'], true], ]; if (!empty($contact['pending'])) { diff --git a/view/templates/hovercard.tpl b/view/templates/hovercard.tpl index ff3b3101a..0162b8327 100644 --- a/view/templates/hovercard.tpl +++ b/view/templates/hovercard.tpl @@ -22,9 +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}}{{/if}}
- {{if $profile.addr}}{{/if}} {{if $profile.actions.network}}{{/if}} {{if $profile.actions.edit}}{{/if}} {{if $profile.actions.follow}}{{/if}} From 405161998e526d14308682117ab69576a5dc359f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz=20=28admin=29?= Date: Sun, 1 Oct 2023 14:33:08 +0200 Subject: [PATCH 4/8] changes to fit to showgroup-button branch --- src/Model/Contact.php | 3 ++- view/templates/hovercard.tpl | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index a8ee93686..7256706e0 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1201,6 +1201,7 @@ class Contact $mention_url = 'compose/0?body=@' . $contact['addr']; $contact_url = 'contact/' . $contact['id']; $posts_link = 'contact/' . $contact['id'] . '/conversations'; + $group_link = 'network/group/' . $contact['id']; $follow_link = ''; $unfollow_link = ''; @@ -1235,7 +1236,7 @@ class Contact 'mention' => [DI::l10n()->t('Mention'), DI::l10n()->t('Post to group'), $mention_url, false], 'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link, true], 'unfollow' => [DI::l10n()->t('Unfollow'), $unfollow_link, true], - 'isgroup' => [$contact['forum'], true], + 'group' => [DI::l10n()->t('View group'), $group_link, $contact['forum'], true], ]; if (!empty($contact['pending'])) { diff --git a/view/templates/hovercard.tpl b/view/templates/hovercard.tpl index 0162b8327..66aba904f 100644 --- a/view/templates/hovercard.tpl +++ b/view/templates/hovercard.tpl @@ -22,7 +22,7 @@ {{* @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}}{{/if}} + {{if $profile.addr}}{{/if}}
{{if $profile.actions.network}}{{/if}} From 17d7432f0e77072a661b18dadee68130913cdee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz=20=28admin=29?= Date: Sun, 1 Oct 2023 14:59:37 +0200 Subject: [PATCH 5/8] set ! and @ on mentioning in hover-card --- src/Content/Widget/VCard.php | 3 --- src/Model/Contact.php | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Content/Widget/VCard.php b/src/Content/Widget/VCard.php index 32eb95e43..d5a565f92 100644 --- a/src/Content/Widget/VCard.php +++ b/src/Content/Widget/VCard.php @@ -68,7 +68,6 @@ class VCard $follow_link = ''; $unfollow_link = ''; $wallmessage_link = ''; - $showforum_link = ''; $photo = Contact::getPhoto($contact); @@ -120,8 +119,6 @@ class VCard '$unfollow_link' => $unfollow_link, '$wallmessage' => DI::l10n()->t('Message'), '$wallmessage_link' => $wallmessage_link, - '$showforum' => DI::l10n()->t('Show forum'), - '$showforum_link' => $showforum_link, '$mentioning' => DI::l10n()->t('Mention'), '$post2group' => DI::l10n()->t('Post to group'), ]); diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 7256706e0..0f426529f 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1198,7 +1198,11 @@ class Contact $pm_url = 'message/new/' . $contact['id']; } - $mention_url = 'compose/0?body=@' . $contact['addr']; + if (in_array($contact['rel'], [contact::SHARING])) { + $mention_url = 'compose/0?body=!' . $contact['addr']; + } else { + $mention_url = 'compose/0?body=@' . $contact['addr']; + } $contact_url = 'contact/' . $contact['id']; $posts_link = 'contact/' . $contact['id'] . '/conversations'; $group_link = 'network/group/' . $contact['id']; From a06e6c7f47a4deb7937dcccc005d077bc3fa8bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz=20=28admin=29?= Date: Sun, 1 Oct 2023 22:36:53 +0200 Subject: [PATCH 6/8] remove mention-button from own profile --- view/templates/hovercard.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/templates/hovercard.tpl b/view/templates/hovercard.tpl index 66aba904f..0fdcffaf2 100644 --- a/view/templates/hovercard.tpl +++ b/view/templates/hovercard.tpl @@ -22,7 +22,7 @@ {{* @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}}{{/if}} + {{if $profile.addr && !$profile.actions.self}}{{/if}}
{{if $profile.actions.network}}{{/if}} From 4b161b0d65780df716fe9d2202a2b600f1e5147f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz=20=28admin=29?= Date: Sun, 1 Oct 2023 22:37:34 +0200 Subject: [PATCH 7/8] set variables for correct mentioning --- src/Model/Contact.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 0f426529f..02132c0f1 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1180,6 +1180,7 @@ 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']; @@ -1203,6 +1204,12 @@ class Contact } 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 +1235,8 @@ class Contact 'edit' => [DI::l10n()->t('View Contact'), $contact_url, false], 'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link, true], '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], ]; } else { $menu = [ @@ -1241,6 +1250,7 @@ class Contact 'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link, true], 'unfollow' => [DI::l10n()->t('Unfollow'), $unfollow_link, true], 'group' => [DI::l10n()->t('View group'), $group_link, $contact['forum'], true], + 'self' => [$self], ]; if (!empty($contact['pending'])) { From bb654d6e34b6231af8cefa5d6b647a7aaeaa56c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz=20=28admin=29?= Date: Sun, 1 Oct 2023 22:38:55 +0200 Subject: [PATCH 8/8] add translations for de for mention-buttons --- view/lang/de/strings.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/view/lang/de/strings.php b/view/lang/de/strings.php index f20617d0b..e9c35e666 100644 --- a/view/lang/de/strings.php +++ b/view/lang/de/strings.php @@ -2961,3 +2961,6 @@ $a->strings['Connect Services'] = 'Verbinde Dienste'; $a->strings['Find Friends'] = 'Kontakte finden'; $a->strings['Last users'] = 'Letzte Nutzer'; $a->strings['Quick Start'] = 'Schnell-Start'; +$a->strings['Mention'] = 'Erwähne'; +$a->strings['Post to group'] = 'In Gruppe posten'; +