From 2f1dfcc3d8ed0ffb6a20275452b2e6f73b49f321 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 11 Sep 2019 13:28:33 -0600 Subject: [PATCH] Calendar - Fix another case of group events not showing properly --- api/js/jsapi/egw_user.js | 18 ++++++++++++++++++ calendar/inc/class.calendar_ui.inc.php | 11 +++++++++++ 2 files changed, 29 insertions(+) diff --git a/api/js/jsapi/egw_user.js b/api/js/jsapi/egw_user.js index c40cd79637..490a7a56cc 100644 --- a/api/js/jsapi/egw_user.js +++ b/api/js/jsapi/egw_user.js @@ -232,6 +232,24 @@ egw.extend('user', egw.MODULE_GLOBAL, function() } }, + /** + * Set account data. This one can be called from the server to pre-fill the cache. + * + * @param {Array} _data + * @param {String} _field + */ + set_account_cache: function(_data, _field) + { + for(var account_id in _data) + { + if (typeof accountData[account_id] === 'undefined') + { + accountData[account_id] = {}; + } + accountData[account_id][_field] = _data[account_id]; + } + }, + /** * Set specified account-data of selected user in an other widget * diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index d28a201ede..50576ea5fd 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -708,6 +708,8 @@ class calendar_ui { if(!$event || !is_array($event)) return false; + static $sent_groups = array(); + if (!$this->bo->check_perms(Acl::EDIT,$event)) { $event['class'] .= 'rowNoEdit '; @@ -786,6 +788,15 @@ class calendar_ui calendar_so::split_user($uid, $user_type, $user_id); $type_name = lang($this->bo->resources[$user_type]['app']); $event['participant_types'][$type_name ? $type_name : ''][] = $text; + if(is_int($uid) && $uid < 0 && !in_array($uid, $sent_groups)) + { + // Make sure group membership info is on the client + Api\Json\Response::get()->apply( + 'egw.set_account_cache', array( + array($uid => $GLOBALS['egw']->accounts->members($uid) ), + 'account_id' + )); + } } $event['date'] = $this->bo->date2string($event['start']);