From eed0fdce03ce4438095b9a1e7a3bfe8fa199f9a1 Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Wed, 20 Feb 2019 13:16:04 -0300 Subject: [PATCH 1/5] Fix frontend fixtures --- client/src/data/fixtures/system-fixtures.js | 5 +++++ client/src/data/fixtures/user-fixtures.js | 2 ++ 2 files changed, 7 insertions(+) diff --git a/client/src/data/fixtures/system-fixtures.js b/client/src/data/fixtures/system-fixtures.js index d12d98b3..00756113 100755 --- a/client/src/data/fixtures/system-fixtures.js +++ b/client/src/data/fixtures/system-fixtures.js @@ -530,5 +530,10 @@ module.exports = [ ] }; } + }, + { + path: '/system/get-custom-fields', + time: 100, + data: [] } ]; diff --git a/client/src/data/fixtures/user-fixtures.js b/client/src/data/fixtures/user-fixtures.js index 5771d7ec..9c633176 100644 --- a/client/src/data/fixtures/user-fixtures.js +++ b/client/src/data/fixtures/user-fixtures.js @@ -159,6 +159,7 @@ module.exports = [ email: 'kurt@currycurrylady.hs', verified: false, sendEmailOnNewTicket: true, + customfields: [], tickets: _.times(13).map(() => { return { ticketNumber: '118551', @@ -379,6 +380,7 @@ module.exports = [ name: 'Haskell Curry', email: 'haskell@lambda.com', sendEmailOnNewTicket: true, + customfields: [], tickets: [ { ticketNumber: '445441', From 4b80a9b397e2ca0a40a883809c91f333d07daeae Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Wed, 20 Feb 2019 14:18:14 -0300 Subject: [PATCH 2/5] Fix #460 issue: Unable to edit email templates with two text fields --- .../panel/settings/admin-panel-email-settings.js | 13 ++++++++----- server/controllers/system/edit-mail-template.php | 12 ++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/client/src/app/admin/panel/settings/admin-panel-email-settings.js b/client/src/app/admin/panel/settings/admin-panel-email-settings.js index 0d6a5125..63ca8139 100644 --- a/client/src/app/admin/panel/settings/admin-panel-email-settings.js +++ b/client/src/app/admin/panel/settings/admin-panel-email-settings.js @@ -185,21 +185,24 @@ class AdminPanelEmailSettings extends React.Component { - {(this.state.form.text2) ? - : null} {(this.state.form.text3) ? - : null}
- {i18n('SAVE')} + { + e.preventDefault(); + this.onFormSubmit(this.state.form); + }}>{i18n('SAVE')}
{(this.state.edited) ? this.renderDiscardButton() : null} @@ -245,7 +248,6 @@ class AdminPanelEmailSettings extends React.Component { onValidateErrors: (errors) => { this.setState({errors}) }, - onSubmit: this.onFormSubmit.bind(this) } } @@ -281,6 +283,7 @@ class AdminPanelEmailSettings extends React.Component { } onFormSubmit(form) { + console.log('form submmited'); const {selectedIndex, language, templates} = this.state; this.setState({loadingForm: true}); diff --git a/server/controllers/system/edit-mail-template.php b/server/controllers/system/edit-mail-template.php index cda7c610..89124538 100755 --- a/server/controllers/system/edit-mail-template.php +++ b/server/controllers/system/edit-mail-template.php @@ -62,7 +62,7 @@ class EditMailTemplateController extends Controller { } public function handler() { - $this->language = Controller::request('language'); + $this->langauge = Controller::request('language'); $this->templateType = Controller::request('template'); $this->subject = Controller::request('subject', true); $this->texts = [ @@ -71,7 +71,7 @@ class EditMailTemplateController extends Controller { Controller::request('text3'), ]; - $mailTemplate = MailTemplate::findOne(' language = ? AND template = ?', [$this->language, $this->templateType]); + $mailTemplate = MailTemplate::findOne(' language = ? AND template = ?', [$this->langauge, $this->templateType]); if($mailTemplate->isNull()) { throw new RequestException(ERRORS::INVALID_TEMPLATE); @@ -90,23 +90,23 @@ class EditMailTemplateController extends Controller { } public function validateReplacements() { - $originalText = MailTexts::getTexts()[$this->language][$this->templateType]; + $originalText = MailTexts::getTexts()[$this->langauge][$this->templateType]; - if(!$this->includes( + if(array_key_exists(1, $originalText) && !$this->includes( $this->getReplacementStrings($originalText[1]), $this->getReplacementStrings($this->texts[0]) )) { throw new RequestException(ERRORS::INVALID_TEXT_1); } - if(!$this->includes( + if(array_key_exists(2, $originalText) && !$this->includes( $this->getReplacementStrings($originalText[2]), $this->getReplacementStrings($this->texts[1]) )) { throw new RequestException(ERRORS::INVALID_TEXT_2); } - if(!$this->includes( + if(array_key_exists(3, $originalText) && !$this->includes( $this->getReplacementStrings($originalText[3]), $this->getReplacementStrings($this->texts[2]) )) { From 133d59e4a7a695de53a6b902289f9032fc5b2eb5 Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Thu, 28 Feb 2019 23:27:03 -0300 Subject: [PATCH 3/5] Remove debbungig console.log --- .../src/app/admin/panel/settings/admin-panel-email-settings.js | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/app/admin/panel/settings/admin-panel-email-settings.js b/client/src/app/admin/panel/settings/admin-panel-email-settings.js index 63ca8139..fa1d06fe 100644 --- a/client/src/app/admin/panel/settings/admin-panel-email-settings.js +++ b/client/src/app/admin/panel/settings/admin-panel-email-settings.js @@ -283,7 +283,6 @@ class AdminPanelEmailSettings extends React.Component { } onFormSubmit(form) { - console.log('form submmited'); const {selectedIndex, language, templates} = this.state; this.setState({loadingForm: true}); From 30dcca3ea3f8a88818b99ec4b52e16243381e7e3 Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Thu, 28 Feb 2019 23:31:01 -0300 Subject: [PATCH 4/5] Fix variable name --- server/controllers/system/edit-mail-template.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/controllers/system/edit-mail-template.php b/server/controllers/system/edit-mail-template.php index 89124538..2646c21a 100755 --- a/server/controllers/system/edit-mail-template.php +++ b/server/controllers/system/edit-mail-template.php @@ -36,7 +36,7 @@ class EditMailTemplateController extends Controller { const PATH = '/edit-mail-template'; const METHOD = 'POST'; - private $langauge; + private $language; private $templateType; private $subject; private $texts; @@ -62,7 +62,7 @@ class EditMailTemplateController extends Controller { } public function handler() { - $this->langauge = Controller::request('language'); + $this->language = Controller::request('language'); $this->templateType = Controller::request('template'); $this->subject = Controller::request('subject', true); $this->texts = [ @@ -71,7 +71,7 @@ class EditMailTemplateController extends Controller { Controller::request('text3'), ]; - $mailTemplate = MailTemplate::findOne(' language = ? AND template = ?', [$this->langauge, $this->templateType]); + $mailTemplate = MailTemplate::findOne(' language = ? AND template = ?', [$this->language, $this->templateType]); if($mailTemplate->isNull()) { throw new RequestException(ERRORS::INVALID_TEMPLATE); @@ -90,7 +90,7 @@ class EditMailTemplateController extends Controller { } public function validateReplacements() { - $originalText = MailTexts::getTexts()[$this->langauge][$this->templateType]; + $originalText = MailTexts::getTexts()[$this->language][$this->templateType]; if(array_key_exists(1, $originalText) && !$this->includes( $this->getReplacementStrings($originalText[1]), From 9cce0ccc8495aaa9432032155e1b9ac1944f89b6 Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Thu, 28 Feb 2019 23:39:02 -0300 Subject: [PATCH 5/5] Fix mocha version for travis ci --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 33223a61..afeccdd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ before_install: - mysql -e 'CREATE DATABASE development;' - nvm install 6.14.4 - npm install -g npm@6.1.0 -- npm install -g mocha +- npm install -g mocha@5.2.0 - cd client - npm install - cd ../tests