Guillermo - fix bug #11
This commit is contained in:
parent
57fdaceaea
commit
cf1490711a
|
@ -35,11 +35,11 @@ class ConfigReducer extends Reducer {
|
|||
const currentLanguage = sessionStore.getItem('language');
|
||||
|
||||
sessionStore.storeConfigs(_.extend({}, payload.data, {
|
||||
language: currentLanguage || payload.language
|
||||
language: currentLanguage || payload.data.language
|
||||
}));
|
||||
|
||||
return _.extend({}, state, payload.data, {
|
||||
language: currentLanguage || payload.language,
|
||||
language: currentLanguage || payload.data.language,
|
||||
registration: !!(payload.data.registration * 1),
|
||||
'user-system-enabled': !!(payload.data['user-system-enabled']* 1),
|
||||
'allow-attachments': !!(payload.data['allow-attachments']* 1),
|
||||
|
@ -56,4 +56,4 @@ class ConfigReducer extends Reducer {
|
|||
}
|
||||
}
|
||||
|
||||
export default ConfigReducer.getInstance();
|
||||
export default ConfigReducer.getInstance();
|
||||
|
|
|
@ -27,6 +27,7 @@ DataValidator::with('CustomValidations', true);
|
|||
* @apiUse INVALID_DEPARTMENT
|
||||
* @apiUse INVALID_LANGUAGE
|
||||
* @apiUse INVALID_CAPTCHA
|
||||
* @apiUse INVALID_EMAIL
|
||||
*
|
||||
* @apiSuccess {Object} data Information of the new ticket
|
||||
* @apiSuccess {Number} data.ticketNumber Number of the new ticket
|
||||
|
@ -74,6 +75,10 @@ class CreateController extends Controller {
|
|||
'validation' => DataValidator::captcha(),
|
||||
'error' => ERRORS::INVALID_CAPTCHA
|
||||
];
|
||||
$validations['requestData']['email'] = [
|
||||
'validation' => DataValidator::email(),
|
||||
'error' => ERRORS::INVALID_EMAIL
|
||||
];
|
||||
}
|
||||
|
||||
return $validations;
|
||||
|
|
|
@ -41,6 +41,29 @@ describe'system/disable-user-system' do
|
|||
(result['message']).should.equal('USER_SYSTEM_DISABLED')
|
||||
end
|
||||
|
||||
it 'should create a ticket without user' do
|
||||
request('/user/logout')
|
||||
result = request('/ticket/create', {
|
||||
title: 'test ticket without user',
|
||||
content: 'The north remembers',
|
||||
departmentId: 1,
|
||||
language: 'en',
|
||||
})
|
||||
|
||||
(result['status']).should.equal('fail')
|
||||
(result['message']).should.equal('INVALID_EMAIL')
|
||||
|
||||
result = request('/ticket/create', {
|
||||
title: 'test ticket without user',
|
||||
content: 'The north remembers',
|
||||
departmentId: 1,
|
||||
language: 'en',
|
||||
email: 'emailtest@opensupports.com'
|
||||
})
|
||||
|
||||
(result['status']).should.equal('success')
|
||||
end
|
||||
|
||||
it 'should not disable the user system if it is already disabled 'do
|
||||
request('/user/logout')
|
||||
Scripts.login($staff[:email], $staff[:password], true)
|
||||
|
@ -69,7 +92,7 @@ describe'system/disable-user-system' do
|
|||
|
||||
numberOftickets= $database.query("SELECT * FROM ticket WHERE author_email IS NULL AND author_name IS NULL AND author_id IS NOT NULL" )
|
||||
|
||||
(numberOftickets.num_rows).should.equal(36)
|
||||
(numberOftickets.num_rows).should.equal(37)
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -13,16 +13,16 @@ describe'/system/get-stats' do
|
|||
|
||||
#day 1
|
||||
for i in 0..5
|
||||
$database.query("INSERT INTO log VALUES('', 'SIGNUP', NULL, " + yesterday3 + ", NULL, NULL);")
|
||||
$database.query("INSERT INTO log VALUES('', 'SIGNUP', NULL, " + yesterday3 + ", NULL, NULL, NULL);")
|
||||
end
|
||||
for i in 0..0
|
||||
$database.query("INSERT INTO log VALUES('', 'CREATE_TICKET', NULL, " + yesterday3 + ", NULL, NULL);")
|
||||
$database.query("INSERT INTO log VALUES('', 'CREATE_TICKET', NULL, " + yesterday3 + ", NULL, NULL, NULL);")
|
||||
end
|
||||
for i in 0..1
|
||||
$database.query("INSERT INTO log VALUES('', 'CLOSE', NULL, " + yesterday3 + ", NULL, NULL);")
|
||||
$database.query("INSERT INTO log VALUES('', 'CLOSE', NULL, " + yesterday3 + ", NULL, NULL, NULL);")
|
||||
end
|
||||
for i in 0..2
|
||||
$database.query("INSERT INTO log VALUES('', 'COMMENT', NULL, " + yesterday3 + ", NULL, NULL);")
|
||||
$database.query("INSERT INTO log VALUES('', 'COMMENT', NULL, " + yesterday3 + ", NULL, NULL, NULL);")
|
||||
end
|
||||
for i in 0..8
|
||||
$database.query("INSERT INTO ticketevent VALUES('', 'CLOSE', NULL, NULL, " + yesterday3 + ", NULL, NULL, 1);")
|
||||
|
@ -33,16 +33,16 @@ describe'/system/get-stats' do
|
|||
|
||||
#day 2
|
||||
for i in 0..7
|
||||
$database.query("INSERT INTO log VALUES('', 'SIGNUP', NULL, " + yesterday2 + ", NULL, NULL);")
|
||||
$database.query("INSERT INTO log VALUES('', 'SIGNUP', NULL, " + yesterday2 + ", NULL, NULL, NULL);")
|
||||
end
|
||||
for i in 0..2
|
||||
$database.query("INSERT INTO log VALUES('', 'CREATE_TICKET', NULL, " + yesterday2 + ", NULL, NULL);")
|
||||
$database.query("INSERT INTO log VALUES('', 'CREATE_TICKET', NULL, " + yesterday2 + ", NULL, NULL, NULL);")
|
||||
end
|
||||
for i in 0..9
|
||||
$database.query("INSERT INTO log VALUES('', 'CLOSE', NULL, " + yesterday2 + ", NULL, NULL);")
|
||||
$database.query("INSERT INTO log VALUES('', 'CLOSE', NULL, " + yesterday2 + ", NULL, NULL, NULL);")
|
||||
end
|
||||
for i in 0..2
|
||||
$database.query("INSERT INTO log VALUES('', 'COMMENT', NULL, " + yesterday2 + ", NULL, NULL);")
|
||||
$database.query("INSERT INTO log VALUES('', 'COMMENT', NULL, " + yesterday2 + ", NULL, NULL, NULL);")
|
||||
end
|
||||
for i in 0..10
|
||||
$database.query("INSERT INTO ticketevent VALUES('', 'CLOSE', NULL, NULL, " + yesterday2 + ", NULL, NULL, 1);")
|
||||
|
@ -53,16 +53,16 @@ describe'/system/get-stats' do
|
|||
|
||||
#day 3
|
||||
for i in 0..0
|
||||
$database.query("INSERT INTO log VALUES('', 'SIGNUP', NULL, " + yesterday + ", NULL, NULL);")
|
||||
$database.query("INSERT INTO log VALUES('', 'SIGNUP', NULL, " + yesterday + ", NULL, NULL, NULL);")
|
||||
end
|
||||
for i in 0..1
|
||||
$database.query("INSERT INTO log VALUES('', 'CREATE_TICKET', NULL, " + yesterday + ", NULL, NULL);")
|
||||
$database.query("INSERT INTO log VALUES('', 'CREATE_TICKET', NULL, " + yesterday + ", NULL, NULL, NULL);")
|
||||
end
|
||||
for i in 0..4
|
||||
$database.query("INSERT INTO log VALUES('', 'CLOSE', NULL, " + yesterday + ", NULL, NULL);")
|
||||
$database.query("INSERT INTO log VALUES('', 'CLOSE', NULL, " + yesterday + ", NULL, NULL, NULL);")
|
||||
end
|
||||
for i in 0..7
|
||||
$database.query("INSERT INTO log VALUES('', 'COMMENT', NULL, " + yesterday + ", NULL, NULL);")
|
||||
$database.query("INSERT INTO log VALUES('', 'COMMENT', NULL, " + yesterday + ", NULL, NULL, NULL);")
|
||||
end
|
||||
for i in 0..3
|
||||
$database.query("INSERT INTO ticketevent VALUES('', 'CLOSE', NULL, NULL, " + yesterday + ", NULL, NULL, 1);")
|
||||
|
|
Loading…
Reference in New Issue