Guillermo - ticket-seen[skip ci]
This commit is contained in:
parent
20b3f6ebc0
commit
ef3bd809aa
|
@ -18,6 +18,22 @@ class SeenController extends Controller {
|
|||
|
||||
public function handler() {
|
||||
$ticketnumber = Controller::request('ticketNumber');
|
||||
|
||||
$user = Controller::getLoggedUser();
|
||||
$ticket = Ticket::getByTicketNumber($ticketnumber);
|
||||
|
||||
if (Controller::isStaffLogged() && $ticket->owner_id === $user->id) {
|
||||
$ticket->unreadStaff = false;
|
||||
$ticket->store();
|
||||
Response::respondSuccess();
|
||||
return;
|
||||
}
|
||||
if (!Controller::isStaffLogged() && $user->id === $ticket->author_id) {
|
||||
$ticket->unread = false;
|
||||
$ticket->store();
|
||||
Response::respondSuccess();
|
||||
return;
|
||||
}
|
||||
Response::respondError(ERRORS::NO_PERMISSION);
|
||||
|
||||
}
|
||||
}
|
|
@ -18,7 +18,8 @@ class Ticket extends DataStore {
|
|||
'priority',
|
||||
'author',
|
||||
'owner',
|
||||
'ownTicketeventList'
|
||||
'ownTicketeventList',
|
||||
'unreadStaff'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue