This commit is contained in:
n1rwana 2021-12-14 21:07:05 +03:00
parent e7dfcdfb67
commit cb8602ef02
3 changed files with 11 additions and 13 deletions

View file

@ -108,7 +108,7 @@ class TicketComment extends RowModel
return false; # Кооостыыыль!!!
}
function getMark(): int
function getMark(): ?int
{
return $this->getRecord()->mark;
}

View file

@ -49,7 +49,7 @@ class TicketComments
// return $this->toTicket($this->tickets->get($id));
// }
function get(int $id): TicketComment
function get(int $id): ?TicketComment
{
$comment = $this->comments->where(['id' => $id])->fetch();
if (!is_null($comment))

View file

@ -233,17 +233,15 @@ final class SupportPresenter extends OpenVKPresenter
$comment = $this->comments->get($id);
if($this->user->id === $this->tickets->get($comment->getTicketId())->getUser()->getId()) {
$comments->setMark($mark);
$comments->save();
if($mark === 1 || $mark === 2) {
exit(header("HTTP/1.1 200 OK"));
} else {
exit(header("HTTP/1.1 400 Bad Request"));
}
} else {
if($this->user->id !== $this->tickets->get($comment->getTicketId())->getUser()->getId())
exit(header("HTTP/1.1 403 Forbidden"));
}
if($mark === 1 || $mark === 2)
header("HTTP/1.1 200 OK");
else
exit(header("HTTP/1.1 400 Bad Request"));
$comment->setMark($mark);
$comment->save();
}
}