From cf71c1a18fddbf5567b6d3efa59290b340bce295 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Thu, 21 Jul 2022 21:57:29 +0200 Subject: [PATCH] Resolve #464 --- dev/Sieve/Model/Filter.js | 4 ++-- dev/Sieve/View/Script.js | 7 +++---- .../v/0.0.0/app/templates/Views/User/PopupsFilter.html | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/dev/Sieve/Model/Filter.js b/dev/Sieve/Model/Filter.js index e96bf717f..24d068f94 100644 --- a/dev/Sieve/Model/Filter.js +++ b/dev/Sieve/Model/Filter.js @@ -233,8 +233,8 @@ export class FilterModel extends AbstractModel { return filter; } - cloneSelf() { - const filter = new FilterModel(); + assignTo(target) { + const filter = target || new FilterModel(); filter.id = this.id; diff --git a/dev/Sieve/View/Script.js b/dev/Sieve/View/Script.js index 9cd1a0663..5914e5521 100644 --- a/dev/Sieve/View/Script.js +++ b/dev/Sieve/View/Script.js @@ -102,12 +102,12 @@ export class SieveScriptPopupView extends rl.pluginPopupView { filter.generateID(); FilterPopupView.showModal([ filter, - () => this.filters.push(filter) + () => this.filters.push(filter.assignTo()) ]); } editFilter(filter) { - const clonedFilter = filter.cloneSelf(); + const clonedFilter = filter.assignTo(); FilterPopupView.showModal([ clonedFilter, () => { @@ -115,8 +115,7 @@ export class SieveScriptPopupView extends rl.pluginPopupView { filters = script.filters(), index = filters.indexOf(filter); if (-1 < index) { -// script.filters.splice(index, 1, clonedFilter); - filters[index] = clonedFilter; + clonedFilter.assignTo(filter); script.filters(filters); } }, diff --git a/snappymail/v/0.0.0/app/templates/Views/User/PopupsFilter.html b/snappymail/v/0.0.0/app/templates/Views/User/PopupsFilter.html index 4e571b229..e02c72e07 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/PopupsFilter.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/PopupsFilter.html @@ -22,7 +22,7 @@ data-i18n="POPUPS_FILTER/SELECT_MATCH_ALL"> -