mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
Support: Fix deleting tickets
This commit is contained in:
parent
763c0c91e2
commit
2af7dcc4f4
1 changed files with 14 additions and 11 deletions
|
@ -116,15 +116,18 @@ final class SupportPresenter extends OpenVKPresenter
|
||||||
{
|
{
|
||||||
$this->assertUserLoggedIn();
|
$this->assertUserLoggedIn();
|
||||||
$this->willExecuteWriteAction();
|
$this->willExecuteWriteAction();
|
||||||
if (!empty($id)) {
|
|
||||||
|
if(!empty($id)) {
|
||||||
$ticket = $this->tickets->get($id);
|
$ticket = $this->tickets->get($id);
|
||||||
if (!$ticket || $ticket->isDeleted() != 0 || $ticket->authorId() !== $this->user->id)
|
if(!$ticket || $ticket->isDeleted() != 0 || $ticket->authorId() !== $this->user->id && !$this->hasPermission('openvk\Web\Models\Entities\TicketReply', 'write', 0)) {
|
||||||
{
|
|
||||||
$this->notFound();
|
$this->notFound();
|
||||||
} else {
|
} else {
|
||||||
$ticket->delete();
|
|
||||||
header("HTTP/1.1 302 Found");
|
header("HTTP/1.1 302 Found");
|
||||||
|
if($ticket->authorId() !== $this->user->id && $this->hasPermission('openvk\Web\Models\Entities\TicketReply', 'write', 0))
|
||||||
|
header("Location: /support/tickets");
|
||||||
|
else
|
||||||
header("Location: /support");
|
header("Location: /support");
|
||||||
|
$ticket->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue