From d23689dae81123a392bcdb6bd7c9eb86b6e6de65 Mon Sep 17 00:00:00 2001 From: djmaze Date: Mon, 25 Jan 2021 22:29:55 +0100 Subject: [PATCH] Bugfix: invalid template id's And cleanup strings --- dev/Model/Filter.js | 35 +++++++++++++---------------------- dev/Model/FilterCondition.js | 16 +++++----------- 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/dev/Model/Filter.js b/dev/Model/Filter.js index 36dabad95..938152a5c 100644 --- a/dev/Model/Filter.js +++ b/dev/Model/Filter.js @@ -75,27 +75,27 @@ export class FilterModel extends AbstractModel { this.addComputables({ nameSub: () => { let result = ''; - const actionValue = this.actionValue(); + const actionValue = this.actionValue(), root = 'SETTINGS_FILTERS/SUBNAME_'; switch (this.actionType()) { case FilterAction.MoveTo: - result = i18n('SETTINGS_FILTERS/SUBNAME_MOVE_TO', { + result = i18n(root + 'MOVE_TO', { FOLDER: fGetRealFolderName(actionValue) }); break; case FilterAction.Forward: - result = i18n('SETTINGS_FILTERS/SUBNAME_FORWARD_TO', { + result = i18n(root + 'FORWARD_TO', { EMAIL: actionValue }); break; case FilterAction.Vacation: - result = i18n('SETTINGS_FILTERS/SUBNAME_VACATION_MESSAGE'); + result = i18n(root + 'VACATION_MESSAGE'); break; case FilterAction.Reject: - result = i18n('SETTINGS_FILTERS/SUBNAME_REJECT'); + result = i18n(root + 'REJECT'); break; case FilterAction.Discard: - result = i18n('SETTINGS_FILTERS/SUBNAME_DISCARD'); + result = i18n(root + 'DISCARD'); break; // no default } @@ -104,31 +104,22 @@ export class FilterModel extends AbstractModel { }, actionTemplate: () => { - let result = ''; - + const result = 'SettingsFiltersAction'; switch (this.actionType()) { case FilterAction.Forward: - result = 'SettingsFilterActionForward'; - break; + return result + 'Forward'; case FilterAction.Vacation: - result = 'SettingsFilterActionVacation'; - break; + return result + 'Vacation'; case FilterAction.Reject: - result = 'SettingsFilterActionReject'; - break; + return result + 'Reject'; case FilterAction.None: - result = 'SettingsFilterActionNone'; - break; + return result + 'None'; case FilterAction.Discard: - result = 'SettingsFilterActionDiscard'; - break; + return result + 'Discard'; case FilterAction.MoveTo: default: - result = 'SettingsFilterActionMoveToFolder'; - break; + return result + 'MoveToFolder'; } - - return result; } }); diff --git a/dev/Model/FilterCondition.js b/dev/Model/FilterCondition.js index 3fd2c15ff..a17c96486 100644 --- a/dev/Model/FilterCondition.js +++ b/dev/Model/FilterCondition.js @@ -44,23 +44,17 @@ export class FilterConditionModel extends AbstractModel { }); this.template = ko.computed(() => { - let template = ''; + const template = 'SettingsFiltersCondition'; switch (this.field()) { case FilterConditionField.Body: - template = 'SettingsFiltersConditionBody'; - break; + return template + 'Body'; case FilterConditionField.Size: - template = 'SettingsFiltersConditionSize'; - break; + return template + 'Size'; case FilterConditionField.Header: - template = 'SettingsFiltersConditionMore'; - break; + return template + 'More'; default: - template = 'SettingsFiltersConditionDefault'; - break; + return template + 'Default'; } - - return template; }, this); this.addSubscribables({