Guillermo - ticket-seen[skip ci]

This commit is contained in:
AntonyAntonio 2016-10-21 01:08:06 -03:00
parent 20b3f6ebc0
commit ef3bd809aa
2 changed files with 19 additions and 2 deletions

View File

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

View File

@ -18,7 +18,8 @@ class Ticket extends DataStore {
'priority',
'author',
'owner',
'ownTicketeventList'
'ownTicketeventList',
'unreadStaff'
);
}