From 98c2ca34f5352124340cbbc07dd787a21efbab14 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 4 May 2021 08:45:27 -0400 Subject: [PATCH] Remove block/ignore links from contact/item action menus for self --- include/conversation.php | 9 +++++---- src/Object/Post.php | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index eae7fd727..0a8f5cfc3 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -888,7 +888,8 @@ function conversation_fetch_items(array $parent, array $items, array $condition, return $items; } -function item_photo_menu($item) { +function item_photo_menu($item) +{ $sub_link = ''; $poke_link = ''; $contact_url = ''; @@ -929,8 +930,8 @@ function item_photo_menu($item) { if (!empty($pcid)) { $contact_url = 'contact/' . $pcid; $posts_link = $contact_url . '/posts'; - $block_link = $contact_url . '/block'; - $ignore_link = $contact_url . '/ignore'; + $block_link = $item['self'] ? '' : $contact_url . '/block'; + $ignore_link = $item['self'] ? '' : $contact_url . '/ignore'; } if ($cid && !$item['self']) { @@ -983,7 +984,7 @@ function item_photo_menu($item) { if (strpos($v, 'javascript:') === 0) { $v = substr($v, 11); $o .= '
  • ' . $k . '
  • ' . PHP_EOL; - } elseif ($v!='') { + } elseif ($v) { $o .= '
  • ' . $k . '
  • ' . PHP_EOL; } } diff --git a/src/Object/Post.php b/src/Object/Post.php index 45b53112b..6973fd236 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -223,9 +223,12 @@ class Post $drop = [ 'dropping' => $dropping, 'pagedrop' => $item['pagedrop'], - 'select' => DI::l10n()->t('Select'), - 'delete' => $delete, + 'select' => DI::l10n()->t('Select'), + 'delete' => $delete, ]; + } + + if (!$item['self']) { $block = [ 'blocking' => true, 'block' => DI::l10n()->t('Block %s', $item['author-name']),