From 96e69cadc483fe8634205853be56e84fe5cb1c75 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 11 Jul 2016 10:43:26 +0500 Subject: - "from" sometimes not handled by mail servers - better handle empty mail user attributes - fix deleting attribute in attribute editor - fix duplicating attribute if name changed --- web/app/view/AttributesController.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'web/app') diff --git a/web/app/view/AttributesController.js b/web/app/view/AttributesController.js index 3028e41eb..2a9e71849 100644 --- a/web/app/view/AttributesController.js +++ b/web/app/view/AttributesController.js @@ -40,17 +40,22 @@ Ext.define('Traccar.view.AttributesController', { store.addListener('add', function (store, records, index, eOpts) { for (i = 0; i < records.length; i++) { this.getView().record.get('attributes')[records[i].get('name')] = records[i].get('value'); - this.getView().record.dirty = true; } + this.getView().record.dirty = true; }, this); store.addListener('update', function (store, record, operation, modifiedFieldNames, details, eOpts) { if (operation === Ext.data.Model.EDIT) { + if (record.modified.name !== record.get('name')) { + delete this.getView().record.get('attributes')[record.modified.name]; + } this.getView().record.get('attributes')[record.get('name')] = record.get('value'); this.getView().record.dirty = true; } }, this); store.addListener('remove', function (store, records, index, isMove, eOpts) { - delete this.getView().record.get('attributes')[records[index].get('name')]; + for (var i = 0; i < records.length; i++) { + delete this.getView().record.get('attributes')[records[i].get('name')]; + } this.getView().record.dirty = true; }, this); -- cgit v1.2.3