From 36b9c99243b62854407bd5f6c4b22ffa73bcb832 Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Fri, 5 Oct 2018 23:54:49 -0300 Subject: [PATCH] Fix issues with no user system --- server/controllers/ticket/comment.php | 2 +- server/models/Ticket.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/controllers/ticket/comment.php b/server/controllers/ticket/comment.php index 5b250812..7be2b248 100755 --- a/server/controllers/ticket/comment.php +++ b/server/controllers/ticket/comment.php @@ -141,7 +141,7 @@ class CommentController extends Controller { $email = $recipient['email']; $name = $recipient['name']; - $isStaff = $recipient['staff']; + $isStaff = array_key_exists('staff', $recipient) && $recipient['staff']; $url = Setting::getSetting('url')->getValue(); diff --git a/server/models/Ticket.php b/server/models/Ticket.php index 702afeec..f407ab02 100755 --- a/server/models/Ticket.php +++ b/server/models/Ticket.php @@ -188,7 +188,7 @@ class Ticket extends DataStore { if(!Controller::isStaffLogged() && $ticketEvent->private) { continue; } - + $events[] = $event; } @@ -200,12 +200,13 @@ class Ticket extends DataStore { } public function isAuthor($user) { + if(!$user->isNull()) return false; $ticketAuthor = $this->authorToArray(); if(is_string($user)) return $user == $ticketAuthor['email']; return $user->id == $ticketAuthor['id'] && ($user instanceof Staff) == $ticketAuthor['staff']; } public function isOwner($user) { - return $this->owner && $user->id == $this->owner->id && ($user instanceof Staff); + return !$user->isNull() && $this->owner && $user->id == $this->owner->id && ($user instanceof Staff); } }