Fix issues with no user system

This commit is contained in:
Ivan Diaz 2018-10-05 23:54:49 -03:00
parent 80589c9ac5
commit 36b9c99243
2 changed files with 4 additions and 3 deletions

View File

@ -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();

View File

@ -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);
}
}