Browse Source

Merge pull request #10208 from MrPetovan/bug/10198-self-no-block-ignore

Prevent self block/ignore
pull/10209/head
Tobias Diekershoff 5 months ago
committed by GitHub
parent
commit
769834bf95
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      include/conversation.php
  2. 8
      src/Module/Contact.php
  3. 7
      src/Object/Post.php
  4. 582
      view/lang/C/messages.po

9
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 .= '<li role="menuitem"><a onclick="' . $v . '">' . $k . '</a></li>' . PHP_EOL;
} elseif ($v!='') {
} elseif ($v) {
$o .= '<li role="menuitem"><a href="' . $v . '">' . $k . '</a></li>' . PHP_EOL;
}
}

8
src/Module/Contact.php

@ -413,6 +413,10 @@ class Contact extends BaseModule
}
if ($cmd === 'block') {
if (public_contact() === $contact_id) {
throw new BadRequestException(DI::l10n()->t('You can\'t block yourself'));
}
self::blockContact($contact_id);
$blocked = Model\Contact\User::isBlocked($contact_id, local_user());
@ -423,6 +427,10 @@ class Contact extends BaseModule
}
if ($cmd === 'ignore') {
if (public_contact() === $contact_id) {
throw new BadRequestException(DI::l10n()->t('You can\'t ignore yourself'));
}
self::ignoreContact($contact_id);
$ignored = Model\Contact\User::isIgnored($contact_id, local_user());

7
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']),

582
view/lang/C/messages.po
File diff suppressed because it is too large
View File

Loading…
Cancel
Save