Merge pull request #6859 from annando/block-contact

The contact menu now displays the contact and posts link as well
This commit is contained in:
Philipp 2019-03-11 22:24:30 +01:00 committed by GitHub
commit db1af5af53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -843,6 +843,8 @@ function item_photo_menu($item) {
$status_link = ''; $status_link = '';
$photos_link = ''; $photos_link = '';
$posts_link = ''; $posts_link = '';
$block_link = '';
$ignore_link = '';
if (local_user() && local_user() == $item['uid'] && $item['parent'] == $item['id'] && !$item['self']) { if (local_user() && local_user() == $item['uid'] && $item['parent'] == $item['id'] && !$item['self']) {
$sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;'; $sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
@ -854,6 +856,7 @@ function item_photo_menu($item) {
$sparkle = (strpos($profile_link, 'redir/') === 0); $sparkle = (strpos($profile_link, 'redir/') === 0);
$cid = 0; $cid = 0;
$pcid = Contact::getIdForURL($item['author-link'], 0, true);
$network = ''; $network = '';
$rel = 0; $rel = 0;
$condition = ['uid' => local_user(), 'nurl' => Strings::normaliseLink($item['author-link'])]; $condition = ['uid' => local_user(), 'nurl' => Strings::normaliseLink($item['author-link'])];
@ -870,6 +873,13 @@ function item_photo_menu($item) {
$profile_link = $profile_link . '?=profile'; $profile_link = $profile_link . '?=profile';
} }
if (!empty($pcid)) {
$contact_url = 'contact/' . $pcid;
$posts_link = 'contact/' . $pcid . '/posts';
$block_link = 'contact/' . $pcid . '/block';
$ignore_link = 'contact/' . $pcid . '/ignore';
}
if ($cid && !$item['self']) { if ($cid && !$item['self']) {
$poke_link = 'poke/?f=&c=' . $cid; $poke_link = 'poke/?f=&c=' . $cid;
$contact_url = 'contact/' . $cid; $contact_url = 'contact/' . $cid;
@ -888,7 +898,9 @@ function item_photo_menu($item) {
L10n::t('View Photos') => $photos_link, L10n::t('View Photos') => $photos_link,
L10n::t('Network Posts') => $posts_link, L10n::t('Network Posts') => $posts_link,
L10n::t('View Contact') => $contact_url, L10n::t('View Contact') => $contact_url,
L10n::t('Send PM') => $pm_url L10n::t('Send PM') => $pm_url,
L10n::t('Block') => $block_link,
L10n::t('Ignore') => $ignore_link
]; ];
if ($network == Protocol::DFRN) { if ($network == Protocol::DFRN) {