mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-31 01:35:15 +02:00
Ivan - Add deploy on dev 3 changes and fixes [skip ci]
This commit is contained in:
parent
c248c8d486
commit
1ca57e1b76
@ -82,7 +82,7 @@ class LanguageSelector extends React.Component {
|
|||||||
case 'supported':
|
case 'supported':
|
||||||
return this.props.supportedLanguages;
|
return this.props.supportedLanguages;
|
||||||
case 'allowed':
|
case 'allowed':
|
||||||
return this.props.supportedLanguages;
|
return this.props.allowedLanguages;
|
||||||
case 'custom':
|
case 'custom':
|
||||||
return this.props.customList;
|
return this.props.customList;
|
||||||
}
|
}
|
||||||
|
@ -60,11 +60,11 @@ class App extends React.Component {
|
|||||||
loggedOutStaff: _.includes(props.location.pathname, '/admin/panel') && !props.session.logged
|
loggedOutStaff: _.includes(props.location.pathname, '/admin/panel') && !props.session.logged
|
||||||
};
|
};
|
||||||
|
|
||||||
if(props.config['maintenance-mode'] && !_.includes(props.location.pathname, '/admin') && !_.includes(props.location.pathname, '/maintenance')) {
|
if(props.config['maintenance-mode'] === '1' && !_.includes(props.location.pathname, '/admin') && !_.includes(props.location.pathname, '/maintenance')) {
|
||||||
browserHistory.push('/maintenance');
|
browserHistory.push('/maintenance');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!props.config['maintenance-mode'] && _.includes(props.location.pathname, '/maintenance')) {
|
if(props.config['maintenance-mode'] === '0' && _.includes(props.location.pathname, '/maintenance')) {
|
||||||
browserHistory.push('/');
|
browserHistory.push('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
|
|
||||||
import API from 'lib-app/api-call';
|
|
||||||
import i18n from 'lib-app/i18n';
|
|
||||||
|
|
||||||
import ActivityRow from 'app-components/activity-row';
|
|
||||||
import SubmitButton from 'core-components/submit-button';
|
|
||||||
|
|
||||||
class ActivityList extends React.Component {
|
|
||||||
|
|
||||||
static propTypes = {
|
|
||||||
mode: React.PropTypes.oneOf(['staff', 'system'])
|
|
||||||
};
|
|
||||||
|
|
||||||
static childContextTypes = {
|
|
||||||
loading: React.PropTypes.bool
|
|
||||||
};
|
|
||||||
|
|
||||||
getChildContext() {
|
|
||||||
return {
|
|
||||||
loading: this.state.loading
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
state = {
|
|
||||||
activities: [],
|
|
||||||
page: 1,
|
|
||||||
limit: false,
|
|
||||||
loading: false
|
|
||||||
};
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
this.retrieveNextPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
if (this.props.mode === 'staff') {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
{this.state.activities.map(this.renderRow.bind(this))}
|
|
||||||
{(!this.state.limit) ? this.renderButton() : null}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
{this.state.activities.map(this.renderRow.bind(this))}
|
|
||||||
{(!this.state.limit) ? this.renderButton() : null}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
renderButton() {
|
|
||||||
return (
|
|
||||||
<SubmitButton type="secondary" onClick={this.retrieveNextPage.bind(this)}>
|
|
||||||
{i18n('LOAD_MORE')}
|
|
||||||
</SubmitButton>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderRow(row) {
|
|
||||||
return (
|
|
||||||
<ActivityRow {...row} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
retrieveNextPage() {
|
|
||||||
this.setState({loading: true});
|
|
||||||
|
|
||||||
API.call({
|
|
||||||
path: '/staff/last-events',
|
|
||||||
data: {
|
|
||||||
page: this.state.page
|
|
||||||
}
|
|
||||||
}).then(this.onRetrieveSuccess.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
onRetrieveSuccess(result) {
|
|
||||||
this.setState({
|
|
||||||
activities: this.state.activities.concat(result.data),
|
|
||||||
page: this.state.page + 1,
|
|
||||||
limit: (result.data.length !== 10),
|
|
||||||
loading: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ActivityList;
|
|
@ -86,7 +86,7 @@ class AdminPanelActivity extends React.Component {
|
|||||||
|
|
||||||
onMenuItemClick(index) {
|
onMenuItemClick(index) {
|
||||||
this.setState({
|
this.setState({
|
||||||
page: 0,
|
page: 1,
|
||||||
mode: (index === 0) ? 'staff' : 'system',
|
mode: (index === 0) ? 'staff' : 'system',
|
||||||
activities: []
|
activities: []
|
||||||
}, this.retrieveNextPage.bind(this));
|
}, this.retrieveNextPage.bind(this));
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import store from 'app/store';
|
||||||
|
|
||||||
|
import ConfigActions from 'actions/config-actions';
|
||||||
import API from 'lib-app/api-call';
|
import API from 'lib-app/api-call';
|
||||||
import i18n from 'lib-app/i18n';
|
import i18n from 'lib-app/i18n';
|
||||||
import LanguageSelector from 'app-components/language-selector';
|
import LanguageSelector from 'app-components/language-selector';
|
||||||
@ -225,6 +227,8 @@ class AdminPanelSystemPreferences extends React.Component {
|
|||||||
'supportedLanguages': result.data.supportedLanguages.map(lang => (_.indexOf(languageKeys, lang)))
|
'supportedLanguages': result.data.supportedLanguages.map(lang => (_.indexOf(languageKeys, lang)))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
store.dispatch(ConfigActions.updateData());
|
||||||
}
|
}
|
||||||
|
|
||||||
onRecoverSettingsFail() {
|
onRecoverSettingsFail() {
|
||||||
|
@ -44,6 +44,7 @@ class MainLayoutHeader extends React.Component {
|
|||||||
return {
|
return {
|
||||||
className: 'main-layout-header__languages',
|
className: 'main-layout-header__languages',
|
||||||
value: this.props.config.language,
|
value: this.props.config.language,
|
||||||
|
type: 'allowed',
|
||||||
onChange: this.changeLanguage.bind(this)
|
onChange: this.changeLanguage.bind(this)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ class MainVerifyTokenPage extends React.Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
API.call({
|
API.call({
|
||||||
path: '/user/verify-token',
|
path: '/user/verify',
|
||||||
data: {
|
data: {
|
||||||
token: this.props.params.token,
|
token: this.props.params.token,
|
||||||
email: this.props.params.email
|
email: this.props.params.email
|
||||||
|
@ -149,7 +149,7 @@ class FormField extends React.Component {
|
|||||||
onChange(nativeEvent) {
|
onChange(nativeEvent) {
|
||||||
let event = nativeEvent;
|
let event = nativeEvent;
|
||||||
|
|
||||||
if (this.props.field === 'checkbox') {
|
if (this.props.field === 'checkbox' && !this.props.decorator) {
|
||||||
event = {
|
event = {
|
||||||
target: {
|
target: {
|
||||||
value: event.target.checked
|
value: event.target.checked
|
||||||
@ -157,7 +157,7 @@ class FormField extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.field === 'select') {
|
if (this.props.field === 'select' && !this.props.decorator) {
|
||||||
event = {
|
event = {
|
||||||
target: {
|
target: {
|
||||||
value: event.index
|
value: event.index
|
||||||
|
@ -237,6 +237,7 @@ export default {
|
|||||||
'ERROR_LIST': 'Select at least one',
|
'ERROR_LIST': 'Select at least one',
|
||||||
'ERROR_URL': 'Invalid URL',
|
'ERROR_URL': 'Invalid URL',
|
||||||
'UNVERIFIED_EMAIL': 'Email is not verified yet',
|
'UNVERIFIED_EMAIL': 'Email is not verified yet',
|
||||||
|
'ERROR_UPDATING_SETTINGS': 'An error occurred while trying to update settings',
|
||||||
|
|
||||||
//MESSAGES
|
//MESSAGES
|
||||||
'SIGNUP_SUCCESS': 'You have registered successfully in our support system.',
|
'SIGNUP_SUCCESS': 'You have registered successfully in our support system.',
|
||||||
|
@ -18,7 +18,7 @@ class GetLogsController extends Controller {
|
|||||||
|
|
||||||
public function handler() {
|
public function handler() {
|
||||||
$page = Controller::request('page');
|
$page = Controller::request('page');
|
||||||
$logList = Log::find('LIMIT ? OFFSET ?', [10, 10*($page-1)+1]);
|
$logList = Log::find('ORDER BY id desc LIMIT ? OFFSET ?', [10, 10*($page-1)+1]);
|
||||||
|
|
||||||
Response::respondSuccess($logList->toArray());
|
Response::respondSuccess($logList->toArray());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<div>
|
<div>
|
||||||
Welcome, {{name}} to our support center,
|
Welcome, {{name}} to our support center,
|
||||||
your email is {{to}},
|
your email is {{to}},
|
||||||
your token is {{verificationToken}}
|
you can verify your user using this link
|
||||||
|
http://dev3.opensupports.com/verify-token/{{to}}/{{verificationToken}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<div>
|
<div>
|
||||||
Bienvenido, {{name}} a nuestro centro de soporte,
|
Bienvenido, {{name}} a nuestro centro de soporte,
|
||||||
tu email es {{to}},
|
tu email es {{to}},
|
||||||
tu codigo de verificacion es {{verificationToken}}
|
podes verificar tu usuatio entrando en este link
|
||||||
|
http://dev3.opensupports.com/verify-token/{{to}}/{{verificationToken}}
|
||||||
</div>
|
</div>
|
@ -6,14 +6,7 @@ use Respect\Validation\Rules\AbstractRule;
|
|||||||
|
|
||||||
class ValidLanguage extends AbstractRule {
|
class ValidLanguage extends AbstractRule {
|
||||||
|
|
||||||
//TODO: Use a list from database instead
|
|
||||||
private $languages = [
|
|
||||||
'en',
|
|
||||||
'es',
|
|
||||||
'de'
|
|
||||||
];
|
|
||||||
|
|
||||||
public function validate($ticketNumber) {
|
public function validate($ticketNumber) {
|
||||||
return in_array($ticketNumber, $this->languages);
|
return in_array($ticketNumber, \Language::LANGUAGES);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,7 +8,7 @@ class Language extends DataStore {
|
|||||||
'es',
|
'es',
|
||||||
'de',
|
'de',
|
||||||
'fr',
|
'fr',
|
||||||
'pr',
|
'pt',
|
||||||
'jp',
|
'jp',
|
||||||
'ru',
|
'ru',
|
||||||
'cn',
|
'cn',
|
||||||
|
@ -6,19 +6,19 @@ describe'system/edit-settings' do
|
|||||||
result= request('/system/edit-settings', {
|
result= request('/system/edit-settings', {
|
||||||
"csrf_userid" => $csrf_userid,
|
"csrf_userid" => $csrf_userid,
|
||||||
"csrf_token" => $csrf_token,
|
"csrf_token" => $csrf_token,
|
||||||
"maintenance-mode" => 1,
|
"maintenance-mode" => false,
|
||||||
"time-zone" => -3,
|
"time-zone" => -3,
|
||||||
"layout" => 'full-width',
|
"layout" => 'full-width',
|
||||||
"allow-attachments" => 1,
|
"allow-attachments" => 1,
|
||||||
"max-size" => 2,
|
"max-size" => 2,
|
||||||
"language" => 'es',
|
"language" => 'en',
|
||||||
"no-reply-email" => 'testemail@hotmail.com'
|
"no-reply-email" => 'testemail@hotmail.com'
|
||||||
})
|
})
|
||||||
|
|
||||||
(result['status']).should.equal('success')
|
(result['status']).should.equal('success')
|
||||||
|
|
||||||
row = $database.getRow('setting', 'maintenance-mode', 'name')
|
row = $database.getRow('setting', 'maintenance-mode', 'name')
|
||||||
(row['value']).should.equal('1')
|
(row['value']).should.equal('0')
|
||||||
|
|
||||||
row = $database.getRow('setting', 'time-zone', 'name')
|
row = $database.getRow('setting', 'time-zone', 'name')
|
||||||
(row['value']).should.equal('-3')
|
(row['value']).should.equal('-3')
|
||||||
@ -30,7 +30,7 @@ describe'system/edit-settings' do
|
|||||||
(row['value']).should.equal('2')
|
(row['value']).should.equal('2')
|
||||||
|
|
||||||
row = $database.getRow('setting', 'language', 'name')
|
row = $database.getRow('setting', 'language', 'name')
|
||||||
(row['value']).should.equal('es')
|
(row['value']).should.equal('en')
|
||||||
|
|
||||||
row = $database.getRow('setting', 'no-reply-email', 'name')
|
row = $database.getRow('setting', 'no-reply-email', 'name')
|
||||||
(row['value']).should.equal('testemail@hotmail.com')
|
(row['value']).should.equal('testemail@hotmail.com')
|
||||||
@ -44,8 +44,8 @@ describe'system/edit-settings' do
|
|||||||
result= request('/system/edit-settings', {
|
result= request('/system/edit-settings', {
|
||||||
"csrf_userid" => $csrf_userid,
|
"csrf_userid" => $csrf_userid,
|
||||||
"csrf_token" => $csrf_token,
|
"csrf_token" => $csrf_token,
|
||||||
"supportedLanguages" => '["en", "pr", "jp", "ru"]',
|
"supportedLanguages" => '["en", "pt", "jp", "ru"]',
|
||||||
"allowedLanguages" => '["en","pr", "jp", "ru", "de"]'
|
"allowedLanguages" => '["en","pt", "jp", "ru", "de"]'
|
||||||
})
|
})
|
||||||
|
|
||||||
(result['status']).should.equal('success')
|
(result['status']).should.equal('success')
|
||||||
@ -53,7 +53,7 @@ describe'system/edit-settings' do
|
|||||||
row = $database.getRow('language', 'en', 'code')
|
row = $database.getRow('language', 'en', 'code')
|
||||||
(row['supported']).should.equal('1')
|
(row['supported']).should.equal('1')
|
||||||
|
|
||||||
row = $database.getRow('language', 'pr', 'code')
|
row = $database.getRow('language', 'pt', 'code')
|
||||||
(row['supported']).should.equal('1')
|
(row['supported']).should.equal('1')
|
||||||
|
|
||||||
row = $database.getRow('language', 'jp', 'code')
|
row = $database.getRow('language', 'jp', 'code')
|
||||||
@ -65,7 +65,7 @@ describe'system/edit-settings' do
|
|||||||
row = $database.getRow('language', 'en', 'code')
|
row = $database.getRow('language', 'en', 'code')
|
||||||
(row['allowed']).should.equal('1')
|
(row['allowed']).should.equal('1')
|
||||||
|
|
||||||
row = $database.getRow('language', 'pr', 'code')
|
row = $database.getRow('language', 'pt', 'code')
|
||||||
(row['allowed']).should.equal('1')
|
(row['allowed']).should.equal('1')
|
||||||
|
|
||||||
row = $database.getRow('language', 'jp', 'code')
|
row = $database.getRow('language', 'jp', 'code')
|
||||||
|
@ -11,7 +11,7 @@ describe '/system/get-settings' do
|
|||||||
(result['data']['allowedLanguages'][1]).should.equal('es')
|
(result['data']['allowedLanguages'][1]).should.equal('es')
|
||||||
(result['data']['allowedLanguages'][2]).should.equal('de')
|
(result['data']['allowedLanguages'][2]).should.equal('de')
|
||||||
(result['data']['allowedLanguages'][3]).should.equal('fr')
|
(result['data']['allowedLanguages'][3]).should.equal('fr')
|
||||||
(result['data']['allowedLanguages'][4]).should.equal('pr')
|
(result['data']['allowedLanguages'][4]).should.equal('pt')
|
||||||
(result['data']['allowedLanguages'][5]).should.equal('jp')
|
(result['data']['allowedLanguages'][5]).should.equal('jp')
|
||||||
(result['data']['allowedLanguages'][6]).should.equal('ru')
|
(result['data']['allowedLanguages'][6]).should.equal('ru')
|
||||||
(result['data']['allowedLanguages'][7]).should.equal('cn')
|
(result['data']['allowedLanguages'][7]).should.equal('cn')
|
||||||
|
@ -8,7 +8,6 @@ describe '/user/get' do
|
|||||||
content: 'A Lannister always pays his debts.',
|
content: 'A Lannister always pays his debts.',
|
||||||
departmentId: 1,
|
departmentId: 1,
|
||||||
language: 'en',
|
language: 'en',
|
||||||
language: 'en',
|
|
||||||
csrf_userid: $csrf_userid,
|
csrf_userid: $csrf_userid,
|
||||||
csrf_token: $csrf_token
|
csrf_token: $csrf_token
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user