fix(calendar(js)): fix refresh of attendees freebusy information

* refresh template with freebusy information of organizer
* fix event coverage in freebusy timeline when event spans a day

Related to bug #4899
This commit is contained in:
Francis Lachapelle 2019-12-03 10:34:47 -05:00
parent 3bb40e4024
commit fbdabc9615
3 changed files with 10 additions and 4 deletions

View file

@ -240,7 +240,9 @@
var index = _.findIndex(this.component.attendees, function(currentAttendee) { var index = _.findIndex(this.component.attendees, function(currentAttendee) {
return currentAttendee.email == attendee.email; return currentAttendee.email == attendee.email;
}); });
this.component.attendees.splice(index, 1); if (index > -1)
this.component.attendees.splice(index, 1);
delete this.$futureFreebusyData[attendee.uid];
}; };
/** /**
@ -270,7 +272,9 @@
roundedStart.setMinutes(15*startQuarter); roundedStart.setMinutes(15*startQuarter);
roundedEnd.setMinutes(15*endQuarter); roundedEnd.setMinutes(15*endQuarter);
_.forEach(roundedStart.daysUpTo(roundedEnd), function(date, index) { _.forEach(roundedStart.beginOfDay().daysUpTo(roundedEnd.beginOfDay()), function(date, index) {
if (date < roundedStart)
date = new Date(roundedStart.getTime());
var currentDay = date.getDate(), var currentDay = date.getDate(),
dayKey = date.getDayString(), dayKey = date.getDayString(),
hourKey; hourKey;

View file

@ -358,8 +358,10 @@
this.removeAttendee = function (attendee, form) { this.removeAttendee = function (attendee, form) {
this.component.$attendees.remove(attendee); this.component.$attendees.remove(attendee);
if (this.component.$attendees.getLength() === 0) if (this.component.$attendees.getLength() === 0) {
this.showAttendeesEditor = false; this.showAttendeesEditor = false;
this.component.$attendees.remove(this.component.organizer);
}
form.$setDirty(); form.$setDirty();
}; };

View file

@ -34,7 +34,7 @@
return $ctrl.component? { return $ctrl.component? {
start: $ctrl.component.start, start: $ctrl.component.start,
end: $ctrl.component.end, end: $ctrl.component.end,
attendees: _.map($ctrl.component.attendees, 'email') attendees: _.keys($ctrl.component.$attendees.$futureFreebusyData)
} : null; } : null;
}, },
function(newAttrs, oldAttrs) { function(newAttrs, oldAttrs) {