From d08a91dcffa33767bc215ee42c3217964372d512 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 23 Nov 2015 16:50:44 +0000 Subject: [PATCH] Fix bug where the refresh did not happen with multiple users selected --- calendar/js/app.js | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/calendar/js/app.js b/calendar/js/app.js index 4d6039d3a8..37fbd605c6 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -264,19 +264,31 @@ app.classes.calendar = AppJS.extend( !(_type == 'add' && event.data.recur_type) ) { - var new_cache_id = app.classes.calendar._daywise_cache_id(event.data.date,this.state.owner) - var daywise = egw.dataGetUIDdata(new_cache_id); - daywise = daywise ? daywise.data : []; - if(_type === 'delete') + var multiple_owner = typeof this.state.owner != 'string' && + this.state.owner.length < parseInt(this.egw.config('calview_no_consolidate','phpgwapi') || 5) ? true : false; + for(var i = 0; i < this.state.owner.length; i++) { - daywise.splice(daywise.indexOf(_id),1); - egw.dataStoreUID('calendar::'+_id, null); + var owner = multiple_owner ? this.state.owner[i] : this.state.owner + var new_cache_id = app.classes.calendar._daywise_cache_id(event.data.date, owner) + var daywise = egw.dataGetUIDdata(new_cache_id); + daywise = daywise ? daywise.data : []; + if(_type === 'delete' || + // Make sure we only update the calendars of those actually in the event + multiple_owner && typeof event.data.participants[owner] == 'undefined') + { + daywise.splice(daywise.indexOf(_id),1); + } + else if (daywise.indexOf(_id) < 0) + { + daywise.push(_id); + } + if(_type === 'delete') + { + egw.dataStoreUID('calendar::'+_id, null); + } + egw.dataStoreUID(new_cache_id,daywise); + if(!multiple_owner) break; } - else if (daywise.indexOf(_id) < 0) - { - daywise.push(_id); - } - egw.dataStoreUID(new_cache_id,daywise); return false; } else