Prevent self block/ignore in Module\Contact
This commit is contained in:
parent
98c2ca34f5
commit
0a1f4d81c8
1 changed files with 8 additions and 0 deletions
|
@ -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());
|
||||||
|
|
Loading…
Reference in a new issue