Merge branch 'add-mention-button' into better-navigation

This commit is contained in:
Jakobus Schürz 2023-10-01 22:55:20 +02:00
commit 0183d33261
7 changed files with 42 additions and 0 deletions

View File

@ -432,6 +432,8 @@ class Item
$this->l10n->t('Network Posts') => $posts_link, $this->l10n->t('Network Posts') => $posts_link,
$this->l10n->t('View Contact') => $contact_url, $this->l10n->t('View Contact') => $contact_url,
$this->l10n->t('Send PM') => $pm_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('Block') => $block_link,
$this->l10n->t('Ignore') => $ignore_link, $this->l10n->t('Ignore') => $ignore_link,
$this->l10n->t('Collapse') => $collapse_link, $this->l10n->t('Collapse') => $collapse_link,

View File

@ -119,6 +119,8 @@ class VCard
'$unfollow_link' => $unfollow_link, '$unfollow_link' => $unfollow_link,
'$wallmessage' => DI::l10n()->t('Message'), '$wallmessage' => DI::l10n()->t('Message'),
'$wallmessage_link' => $wallmessage_link, '$wallmessage_link' => $wallmessage_link,
'$mentioning' => DI::l10n()->t('Mention'),
'$post2group' => DI::l10n()->t('Post to group'),
]); ]);
} }
} }

View File

@ -1177,8 +1177,10 @@ class Contact
} }
$pm_url = ''; $pm_url = '';
$mention_url = '';
$status_link = ''; $status_link = '';
$photos_link = ''; $photos_link = '';
$self = false;
if (($contact['network'] === Protocol::DFRN) && !$contact['self'] && empty($contact['pending'])) { if (($contact['network'] === Protocol::DFRN) && !$contact['self'] && empty($contact['pending'])) {
$profile_link = 'contact/redir/' . $contact['id']; $profile_link = 'contact/redir/' . $contact['id'];
@ -1197,8 +1199,20 @@ class Contact
$pm_url = 'message/new/' . $contact['id']; $pm_url = 'message/new/' . $contact['id'];
} }
if (in_array($contact['rel'], [contact::SHARING])) {
$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']; $contact_url = 'contact/' . $contact['id'];
$posts_link = 'contact/' . $contact['id'] . '/conversations'; $posts_link = 'contact/' . $contact['id'] . '/conversations';
$group_link = 'network/group/' . $contact['id'];
$follow_link = ''; $follow_link = '';
$unfollow_link = ''; $unfollow_link = '';
@ -1221,6 +1235,8 @@ class Contact
'edit' => [DI::l10n()->t('View Contact'), $contact_url, false], 'edit' => [DI::l10n()->t('View Contact'), $contact_url, false],
'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link, true], 'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link, true],
'unfollow' => [DI::l10n()->t('Unfollow'), $unfollow_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 { } else {
$menu = [ $menu = [
@ -1230,8 +1246,11 @@ class Contact
'network' => [DI::l10n()->t('Network Posts'), $posts_link, false], 'network' => [DI::l10n()->t('Network Posts'), $posts_link, false],
'edit' => [DI::l10n()->t('View Contact'), $contact_url, false], 'edit' => [DI::l10n()->t('View Contact'), $contact_url, false],
'pm' => [DI::l10n()->t('Send PM'), $pm_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], 'follow' => [DI::l10n()->t('Connect/Follow'), $follow_link, true],
'unfollow' => [DI::l10n()->t('Unfollow'), $unfollow_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'])) { if (!empty($contact['pending'])) {

View File

@ -2961,3 +2961,6 @@ $a->strings['Connect Services'] = 'Verbinde Dienste';
$a->strings['Find Friends'] = 'Kontakte finden'; $a->strings['Find Friends'] = 'Kontakte finden';
$a->strings['Last users'] = 'Letzte Nutzer'; $a->strings['Last users'] = 'Letzte Nutzer';
$a->strings['Quick Start'] = 'Schnell-Start'; $a->strings['Quick Start'] = 'Schnell-Start';
$a->strings['Mention'] = 'Erwähne';
$a->strings['Post to group'] = 'In Gruppe posten';

View File

@ -22,6 +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 *}} {{* @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 *}}
<div class="hover-card-actions-social"> <div class="hover-card-actions-social">
{{if $profile.actions.pm}}<a class="btn btn-labeled btn-primary btn-sm add-to-modal" href="{{$profile.actions.pm.1}}" aria-label="{{$profile.actions.pm.0}}"><i class="fa fa-envelope" aria-hidden="true" title="{{$profile.actions.pm.0}}"></i><span class="sr-only">{{$profile.actions.pm.0}}</span></a>{{/if}} {{if $profile.actions.pm}}<a class="btn btn-labeled btn-primary btn-sm add-to-modal" href="{{$profile.actions.pm.1}}" aria-label="{{$profile.actions.pm.0}}"><i class="fa fa-envelope" aria-hidden="true" title="{{$profile.actions.pm.0}}"></i><span class="sr-only">{{$profile.actions.pm.0}}</span></a>{{/if}}
{{if $profile.addr && !$profile.actions.self}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.mention.2}}" aria-label="{{if $profile.actions.group.2==1}}{{$profile.actions.mention.1}}{{else}}{{$profile.actions.mention.0}}{{/if}}" title="{{$profile.actions.rel.0}}{{if $profile.actions.group.2==1}}{{$profile.actions.mention.1}}{{else}}{{$profile.actions.mention.0}}{{/if}}"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>{{/if}}
</div> </div>
<div class="hover-card-actions-connection"> <div class="hover-card-actions-connection">
{{if $profile.actions.network}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.network.1}}" aria-label="{{$profile.actions.network.0}}" title="{{$profile.actions.network.0}}"><i class="fa fa-cloud" aria-hidden="true"></i></a>{{/if}} {{if $profile.actions.network}}<a class="btn btn-labeled btn-primary btn-sm" href="{{$profile.actions.network.1}}" aria-label="{{$profile.actions.network.0}}" title="{{$profile.actions.network.0}}"><i class="fa fa-cloud" aria-hidden="true"></i></a>{{/if}}

View File

@ -70,6 +70,13 @@
</button> </button>
</div> </div>
{{/if}} {{/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}}')">
<span class=""><i class="fa fa-pencil-square-o"></i></span>
<span class="">{{$mentioning}}</span>
</div>
{{/if}}
</div> </div>
{{/if}} {{/if}}

View File

@ -56,6 +56,14 @@
</button> </button>
</div> </div>
{{/if}} {{/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}}')">
<span class=""><i class="fa fa-pencil-square-o"></i></span>
<span class="">{{if $contact.forum==1}}{{$post2group}}{{else}}{{$mentioning}}{{/if}}</span>
</button>
</div>
{{/if}}
</div> </div>
<div class="clear"></div> <div class="clear"></div>