Fixed error on block action.
Trying to block a mod or admin would redirect to action with no specific id, generating an error.
This commit is contained in:
parent
30f9b207fd
commit
afad5bc175
@ -337,12 +337,13 @@ class UserController extends ApplicationController
|
|||||||
if ($this->request()->isPost()) {
|
if ($this->request()->isPost()) {
|
||||||
if ($this->user->is_mod_or_higher()) {
|
if ($this->user->is_mod_or_higher()) {
|
||||||
$this->notice("You can not ban other moderators or administrators");
|
$this->notice("You can not ban other moderators or administrators");
|
||||||
$this->redirectTo('#block');
|
$this->redirectTo(['#block', 'id' => $this->params()->id]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
!is_array($this->params()->ban) && $this->params()->ban = [];
|
!is_array($this->params()->ban) && $this->params()->ban = [];
|
||||||
|
|
||||||
$attrs = array_merge($this->params()->ban, ['banned_by' => current_user()->id, 'user_id' => $this->params()->id]);
|
$attrs = array_merge($this->params()->ban, ['banned_by' => current_user()->id, 'user_id' => $this->params()->id]);
|
||||||
|
|
||||||
Ban::create($attrs);
|
Ban::create($attrs);
|
||||||
$this->redirectTo('#show_blocked_users');
|
$this->redirectTo('#show_blocked_users');
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user