From 4ca2b83ac16a146b8acd35e49d53bcb80509cf7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20Wei=C3=9F?= Date: Wed, 10 Jan 2024 11:39:29 +0100 Subject: [PATCH] fix(Calendar): attendeeFilter shows name proxy --- tine20/Calendar/js/AttendeeFilterModel.js | 33 ++++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/tine20/Calendar/js/AttendeeFilterModel.js b/tine20/Calendar/js/AttendeeFilterModel.js index d24a197713b..41dcd661e96 100644 --- a/tine20/Calendar/js/AttendeeFilterModel.js +++ b/tine20/Calendar/js/AttendeeFilterModel.js @@ -133,19 +133,26 @@ Tine.Calendar.AttendeeFilterModelValueField = Ext.extend(Ext.ux.form.LayerCombo, setValue: function(value) { value = Ext.isArray(value) ? value : [value]; this.attendeeData = value; - this.currentValue = []; - - var attendeeStore = Tine.Calendar.Model.Attender.getAttendeeStore(value); - - var a = []; - attendeeStore.each(function(attender) { - this.currentValue.push(attender.data); - var name = Tine.Calendar.AttendeeGridPanel.prototype.renderAttenderName.call(Tine.Calendar.AttendeeGridPanel.prototype, attender.get('user_id'), {noIcon: true}, attender); - //var status = Tine.Calendar.AttendeeGridPanel.prototype.renderAttenderStatus.call(Tine.Calendar.AttendeeGridPanel.prototype, attender.get('status'), {}, attender); - a.push(name/* + ' (' + status + ')'*/); - }, this); - - this.setRawValue(a.join(', ')); + const currentValue = this.currentValue = []; + const attendeeStore = Tine.Calendar.Model.Attender.getAttendeeStore(value); + + Promise.all(_.map(attendeeStore.data.items, function(attendee) { + currentValue.push(attendee.data); + return new Promise(resolve => { + const name = Tine.Calendar.AttendeeGridPanel.prototype.renderAttenderName.call(Tine.Calendar.AttendeeGridPanel.prototype, attendee.get('user_id'), {noIcon: true}, attendee); + if (name && name.registerReplacer) { + name.registerReplacer((name) => { + resolve(name); + }); + } else { + resolve(name); + } + }); + })).then(names => { + const value = names.join(', '); + this.setRawValue(value || this.emptyText); + this.el[(value ? 'remove' : 'add') + 'Class'](this.emptyClass); + }); return this; },