mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Исправлен редирект после удаления аватарки сообщества (#967)
This commit is contained in:
parent
0d66c8e9d6
commit
e433e46b36
1 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
<?php declare(strict_types=1);
|
||||
namespace openvk\Web\Presenters;
|
||||
use openvk\Web\Models\Entities\{Club, Photo, Album};
|
||||
use openvk\Web\Models\Entities\{Club, Photo, Album, User};
|
||||
use openvk\Web\Models\Repositories\{Photos, Albums, Users, Clubs};
|
||||
use Nette\InvalidStateException as ISE;
|
||||
|
||||
|
@ -292,11 +292,13 @@ final class PhotosPresenter extends OpenVKPresenter
|
|||
if(!$photo) $this->notFound();
|
||||
if(is_null($this->user) || $this->user->id != $ownerId)
|
||||
$this->flashFail("err", "Ошибка доступа", "Недостаточно прав для модификации данного ресурса.");
|
||||
|
||||
|
||||
$redirect = $photo->getAlbum()->getOwner() instanceof User ? "/id0" : "/club" . $ownerId;
|
||||
|
||||
$photo->isolate();
|
||||
$photo->delete();
|
||||
|
||||
$this->flash("succ", "Фотография удалена", "Эта фотография была успешно удалена.");
|
||||
$this->redirect("/id0");
|
||||
$this->redirect($redirect);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue