From 01720ae128d0e00d74d3ead150d57a9d21a9e66f Mon Sep 17 00:00:00 2001 From: Tomas Bures Date: Mon, 31 Dec 2018 10:11:44 +0000 Subject: [PATCH] Bugfix - merge tag was incorrectly validate when only name was entered and Save was clicked immediately after --- client/src/campaigns/CUD.js | 4 ++-- client/src/lists/fields/CUD.js | 8 ++++---- client/src/lists/segments/RuleSettingsPane.js | 8 ++++---- client/src/send-configurations/CUD.js | 4 ++-- client/src/send-configurations/helpers.js | 6 +++--- client/src/templates/CUD.js | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/client/src/campaigns/CUD.js b/client/src/campaigns/CUD.js index ba2792a4..c1fe1701 100644 --- a/client/src/campaigns/CUD.js +++ b/client/src/campaigns/CUD.js @@ -137,9 +137,9 @@ export default class CUD extends Component { return id; } - onCustomTemplateTypeChanged(mutState, key, oldType, type) { + onCustomTemplateTypeChanged(mutStateData, key, oldType, type) { if (type) { - this.templateTypes[type].afterTypeChange(mutState); + this.templateTypes[type].afterTypeChange(mutStateData); } } diff --git a/client/src/lists/fields/CUD.js b/client/src/lists/fields/CUD.js index 0c2975d7..b2a01758 100644 --- a/client/src/lists/fields/CUD.js +++ b/client/src/lists/fields/CUD.js @@ -64,7 +64,7 @@ export default class CUD extends Component { changed: ['key'], extra: ['id'] }, - onChange: { + onChangeBeforeValidation: { name: ::this.onChangeName } }); @@ -77,13 +77,13 @@ export default class CUD extends Component { entity: PropTypes.object } - onChangeName(state, attr, oldValue, newValue) { + onChangeName(mutStateData, attr, oldValue, newValue) { const oldComputedKey = ('MERGE_' + slugify(oldValue, '_')).toUpperCase().replace(/[^A-Z0-9_]/g, ''); - const oldKey = state.formState.getIn(['data', 'key', 'value']); + const oldKey = mutStateData.getIn(['key', 'value']); if (oldKey === '' || oldKey === oldComputedKey) { const newKey = ('MERGE_' + slugify(newValue, '_')).toUpperCase().replace(/[^A-Z0-9_]/g, ''); - state.formState = state.formState.setIn(['data', 'key', 'value'], newKey); + mutStateData.setIn(['key', 'value'], newKey); } } diff --git a/client/src/lists/segments/RuleSettingsPane.js b/client/src/lists/segments/RuleSettingsPane.js index 5092a7bd..ab7d8bc4 100644 --- a/client/src/lists/segments/RuleSettingsPane.js +++ b/client/src/lists/segments/RuleSettingsPane.js @@ -123,12 +123,12 @@ export default class RuleSettingsPane extends PureComponent { } } - populateRuleDefaults(mutState) { + populateRuleDefaults(mutStateData) { const ruleHelpers = this.ruleHelpers; - const type = mutState.getIn(['type','value']); + const type = mutStateData.getIn(['type','value']); if (!ruleHelpers.isCompositeRuleType(type)) { - const column = mutState.getIn(['column', 'value']); + const column = mutStateData.getIn(['column', 'value']); if (column) { const colType = ruleHelpers.getColumnType(column); @@ -137,7 +137,7 @@ export default class RuleSettingsPane extends PureComponent { const settings = ruleHelpers.primitiveRuleTypes[colType][type]; if (!settings) { // The existing rule type does not fit the newly changed column. This resets the rule type chooser to "--- Select ---" - mutState.setIn(['type', 'value'], ''); + mutStateData.setIn(['type', 'value'], ''); } } } diff --git a/client/src/send-configurations/CUD.js b/client/src/send-configurations/CUD.js index 67c23ca5..f073a0b4 100644 --- a/client/src/send-configurations/CUD.js +++ b/client/src/send-configurations/CUD.js @@ -73,9 +73,9 @@ export default class CUD extends Component { entity: PropTypes.object } - onMailerTypeChanged(mutState, key, oldType, type) { + onMailerTypeChanged(mutStateDate, key, oldType, type) { if (type) { - this.mailerTypes[type].afterTypeChange(mutState); + this.mailerTypes[type].afterTypeChange(mutStateDate); } } diff --git a/client/src/send-configurations/helpers.js b/client/src/send-configurations/helpers.js index f134d906..114a8fa1 100644 --- a/client/src/send-configurations/helpers.js +++ b/client/src/send-configurations/helpers.js @@ -23,12 +23,12 @@ export const mailerTypesOrder = [ export function getMailerTypes(t) { const mailerTypes = {}; - function initFieldsIfMissing(mutState, mailerType) { + function initFieldsIfMissing(mutStateData, mailerType) { const initVals = mailerTypes[mailerType].initData(); for (const key in initVals) { - if (!mutState.hasIn([key])) { - mutState.setIn([key, 'value'], initVals[key]); + if (!mutStateData.hasIn([key])) { + mutStateData.setIn([key, 'value'], initVals[key]); } } } diff --git a/client/src/templates/CUD.js b/client/src/templates/CUD.js index 879805af..c759ceba 100644 --- a/client/src/templates/CUD.js +++ b/client/src/templates/CUD.js @@ -77,9 +77,9 @@ export default class CUD extends Component { entity: PropTypes.object } - onTypeChanged(mutState, key, oldType, type) { + onTypeChanged(mutStateData, key, oldType, type) { if (type) { - this.templateTypes[type].afterTypeChange(mutState); + this.templateTypes[type].afterTypeChange(mutStateData); } }