Prevent self block/ignore in Module\Contact
This commit is contained in:
@@ -413,6 +413,10 @@ class Contact extends BaseModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($cmd === 'block') {
|
if ($cmd === 'block') {
|
||||||
|
if (public_contact() === $contact_id) {
|
||||||
|
throw new BadRequestException(DI::l10n()->t('You can\'t block yourself'));
|
||||||
|
}
|
||||||
|
|
||||||
self::blockContact($contact_id);
|
self::blockContact($contact_id);
|
||||||
|
|
||||||
$blocked = Model\Contact\User::isBlocked($contact_id, local_user());
|
$blocked = Model\Contact\User::isBlocked($contact_id, local_user());
|
||||||
@@ -423,6 +427,10 @@ class Contact extends BaseModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($cmd === 'ignore') {
|
if ($cmd === 'ignore') {
|
||||||
|
if (public_contact() === $contact_id) {
|
||||||
|
throw new BadRequestException(DI::l10n()->t('You can\'t ignore yourself'));
|
||||||
|
}
|
||||||
|
|
||||||
self::ignoreContact($contact_id);
|
self::ignoreContact($contact_id);
|
||||||
|
|
||||||
$ignored = Model\Contact\User::isIgnored($contact_id, local_user());
|
$ignored = Model\Contact\User::isIgnored($contact_id, local_user());
|
||||||
|
|||||||
Reference in New Issue
Block a user