12398 groupmember filter adds wrong attendee
authorCornelius Weiß <c.weiss@metaways.de>
Mon, 5 Dec 2016 11:26:57 +0000 (12:26 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 8 Dec 2016 12:53:48 +0000 (13:53 +0100)
Change-Id: Iad24fec2bf8689f648c7fe58029aa972c94af3ce
Reviewed-on: http://gerrit.tine20.com/customers/3915
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Calendar/js/Model.js

index 16d5f9d..1b01afe 100644 (file)
@@ -249,7 +249,19 @@ Tine.Calendar.Model.Event.getDefaultAttendee = function(organizer, container) {
                 ownAttendee = Tine.Calendar.Model.Attender.getAttendeeStore.getMyAttenderRecord(attendeeStore);
                 
             attendeeStore.each(function(attendee){
-                var attendeeData = attendee.data.user_type == 'user' ? Ext.apply(attendee.data, defaultAttendeeData) : Ext.apply(attendee.data, defaultResourceData);
+                var attendeeData = Ext.applyIf(Ext.decode(Ext.encode(attendee.data)), defaultAttendeeData);
+
+                switch (attendeeData.user_type.toLowerCase()) {
+                    case 'memberof':
+                        attendeeData.user_type = 'group';
+                        break;
+                    case 'resource':
+                        Ext.apply(attendeeData, defaultResourceData);
+                        break;
+                    default:
+                        break;
+                }
+
                 if (attendee == ownAttendee) {
                     attendeeData.status = 'ACCEPTED';
                 }