Fixing #10699 (prohibits blocking and ignoreing from the photo menu)

This commit is contained in:
Philipp 2021-09-12 21:20:12 +02:00
parent 5246b9c4b0
commit a65fbcebe7
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
3 changed files with 14 additions and 10 deletions

View file

@ -20,6 +20,7 @@
*/
use Friendica\App;
use Friendica\BaseModule;
use Friendica\Content\ContactSelector;
use Friendica\Content\Feature;
use Friendica\Core\ACL;
@ -396,6 +397,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
$threadsid = -1;
$page_template = Renderer::getMarkupTemplate("conversation.tpl");
$formSecurityToken = BaseModule::getFormSecurityToken('contact_action');
if (!empty($items)) {
if (in_array($mode, ['community', 'contacts'])) {
@ -502,7 +504,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link']),
'linktitle' => DI::l10n()->t('View %s\'s profile @ %s', $profile_name, $item['author-link']),
'profile_url' => $profile_link,
'item_photo_menu_html' => item_photo_menu($item),
'item_photo_menu_html' => item_photo_menu($item, $formSecurityToken),
'name' => $profile_name,
'sparkle' => $sparkle,
'lock' => false,
@ -590,7 +592,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
}
}
$threads = $conv->getTemplateData($conv_responses);
$threads = $conv->getTemplateData($conv_responses, $formSecurityToken);
if (!$threads) {
Logger::log('[ERROR] conversation : Failed to get template data.', Logger::DEBUG);
$threads = [];
@ -782,7 +784,7 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid)
return $items;
}
function item_photo_menu($item)
function item_photo_menu($item, string $formSecurityToken)
{
DI::profiler()->startRecording('rendering');
$sub_link = '';
@ -825,8 +827,8 @@ function item_photo_menu($item)
if (!empty($pcid)) {
$contact_url = 'contact/' . $pcid;
$posts_link = $contact_url . '/posts';
$block_link = $item['self'] ? '' : $contact_url . '/block';
$ignore_link = $item['self'] ? '' : $contact_url . '/ignore';
$block_link = $item['self'] ? '' : $contact_url . '/block?t=' . $formSecurityToken;
$ignore_link = $item['self'] ? '' : $contact_url . '/ignore?t=' . $formSecurityToken;
}
if ($cid && !$item['self']) {