fix ticket seen path and tests
This commit is contained in:
parent
620cd6b876
commit
4b2d27e757
|
@ -44,7 +44,7 @@ class SeenController extends Controller {
|
||||||
$user = Controller::getLoggedUser();
|
$user = Controller::getLoggedUser();
|
||||||
$ticket = Ticket::getByTicketNumber($ticketnumber);
|
$ticket = Ticket::getByTicketNumber($ticketnumber);
|
||||||
|
|
||||||
if(!$user->canManageTicket($this->ticket) && !$ticket->isAuthor($user)) {
|
if(!$user->canManageTicket($ticket) && !$ticket->isAuthor($user)) {
|
||||||
throw new RequestException(ERRORS::NO_PERMISSION);
|
throw new RequestException(ERRORS::NO_PERMISSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ require './user/edit-email.rb'
|
||||||
require './user/get.rb'
|
require './user/get.rb'
|
||||||
require './user/enable-disable.rb'
|
require './user/enable-disable.rb'
|
||||||
require './ticket/create.rb'
|
require './ticket/create.rb'
|
||||||
|
require './ticket/seen.rb'
|
||||||
require './ticket/comment.rb'
|
require './ticket/comment.rb'
|
||||||
require './ticket/get.rb'
|
require './ticket/get.rb'
|
||||||
require './ticket/custom-response.rb'
|
require './ticket/custom-response.rb'
|
||||||
|
|
|
@ -2,10 +2,12 @@ describe '/ticket/seen' do
|
||||||
|
|
||||||
describe 'when a staff is logged' do
|
describe 'when a staff is logged' do
|
||||||
request('/user/logout')
|
request('/user/logout')
|
||||||
Scripts.login($staff[:email], $staff[:password], true)
|
ticket = $database.getRow('ticket', 1, 'id')
|
||||||
|
|
||||||
|
Scripts.login($staff[:email], $staff[:password], true)
|
||||||
|
Scripts.assignTicket(ticket['ticket_number'])
|
||||||
it 'should change unread if everything is okey ' do
|
it 'should change unread if everything is okey ' do
|
||||||
ticket = $database.getRow('ticket', 1, 'id')
|
|
||||||
result = request('/ticket/seen', {
|
result = request('/ticket/seen', {
|
||||||
ticketNumber: ticket['ticket_number'],
|
ticketNumber: ticket['ticket_number'],
|
||||||
csrf_userid: $csrf_userid,
|
csrf_userid: $csrf_userid,
|
||||||
|
@ -13,7 +15,7 @@ describe '/ticket/seen' do
|
||||||
})
|
})
|
||||||
(result['status']).should.equal('success')
|
(result['status']).should.equal('success')
|
||||||
ticket = $database.getRow('ticket', 1, 'id')
|
ticket = $database.getRow('ticket', 1, 'id')
|
||||||
(ticket['unreadStaff']).should.equal('0')
|
(ticket['unread_staff']).should.equal('0')
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -21,7 +23,7 @@ describe '/ticket/seen' do
|
||||||
describe 'when an user is logged' do
|
describe 'when an user is logged' do
|
||||||
|
|
||||||
request('/user/logout')
|
request('/user/logout')
|
||||||
Scripts.login()
|
Scripts.login('user_get@os4.com', 'user_get')
|
||||||
it 'should change unread if everything is okey ' do
|
it 'should change unread if everything is okey ' do
|
||||||
ticket = $database.getRow('ticket', 1, 'id')
|
ticket = $database.getRow('ticket', 1, 'id')
|
||||||
result = request('/ticket/seen', {
|
result = request('/ticket/seen', {
|
||||||
|
|
Loading…
Reference in New Issue