diff --git a/calendar/js/et2_widget_event.js b/calendar/js/et2_widget_event.js index 071877ba8b..3e3bfb268e 100644 --- a/calendar/js/et2_widget_event.js +++ b/calendar/js/et2_widget_event.js @@ -684,9 +684,11 @@ var et2_calendar_event = /** @class */ (function (_super) { * * @param event * @param filter + * @param owner The owner of the target / parent, not the event owner * @private */ et2_calendar_event.prototype._status_check = function (event, filter, owner) { + var _a; if (!owner || !event) { return false; } @@ -717,12 +719,16 @@ var et2_calendar_event = /** @class */ (function (_super) { } if ((isNaN(parseInt(owner)) || parseInt(owner) < 0) && options && typeof options.find == "function") { var resource = options.find(function (element) { - return element.id == owner; + return element.id == owner && element.resources; }) || {}; - if (resource && resource.resources) { - var matching_participant = resource.resources.filter(function (id) { return typeof event.participants[id] != "undefined"; }); + var matching_participant = (_a = resource) === null || _a === void 0 ? void 0 : _a.resources.filter(function (id) { return typeof event.participants[id] != "undefined"; }); + if (matching_participant.length > 0) { return this._status_check(event, filter, matching_participant); } + else if (filter == 'owner' && resource && resource.resources.indexOf(event.owner)) { + // owner param was a group but event is owned by someone in that group + return true; + } } } var status = et2_calendar_event.split_status(participant); diff --git a/calendar/js/et2_widget_event.ts b/calendar/js/et2_widget_event.ts index 30be710b0f..29244b49da 100644 --- a/calendar/js/et2_widget_event.ts +++ b/calendar/js/et2_widget_event.ts @@ -881,6 +881,7 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached * * @param event * @param filter + * @param owner The owner of the target / parent, not the event owner * @private */ _status_check(event, filter: string, owner: string | string[]): boolean @@ -929,13 +930,18 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached { let resource = options.find(function (element) { - return element.id == owner; + return element.id == owner && element.resources; }) || {}; - if(resource && resource.resources) + let matching_participant = resource?.resources.filter(id => typeof event.participants[id] != "undefined"); + if(matching_participant.length > 0) { - let matching_participant = resource.resources.filter(id => typeof event.participants[id] != "undefined"); return this._status_check(event, filter, matching_participant); } + else if (filter == 'owner' && resource && resource.resources.indexOf(event.owner)) + { + // owner param was a group but event is owned by someone in that group + return true; + } } }