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

Prevent self block/ignore
pull/10209/head
Tobias Diekershoff 2021-05-04 15:43:28 +02:00 zatwierdzone przez GitHub
commit 769834bf95
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 320 dodań i 300 usunięć

Wyświetl plik

@ -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;
}
}

Wyświetl plik

@ -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());

Wyświetl plik

@ -226,6 +226,9 @@ class Post
'select' => DI::l10n()->t('Select'),
'delete' => $delete,
];
}
if (!$item['self']) {
$block = [
'blocking' => true,
'block' => DI::l10n()->t('Block %s', $item['author-name']),

Plik diff jest za duży Load Diff