Calendar: Fix some client side filter bugs

- Resources that weren't the first selected were not displayed properly
- Selecting a group via ajax under certain conditions would not display its events
This commit is contained in:
nathangray 2020-05-06 11:00:47 -06:00
parent c6200f9969
commit 4d6a2cf1b1
3 changed files with 9 additions and 6 deletions

View File

@ -206,7 +206,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
); );
foreach($lists as $list_id => $list) foreach($lists as $list_id => $list)
{ {
$_results[$list_id] = array( $_results[''+$list_id] = array(
'label' => $list, 'label' => $list,
'resources' => $bo->enum_mailing_list($type.$list_id) 'resources' => $bo->enum_mailing_list($type.$list_id)
); );
@ -247,7 +247,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
)); ));
if($id < 0) if($id < 0)
{ {
$value['resources'] = $GLOBALS['egw']->accounts->members($id, true); $value['resources'] = array_map('strval',$GLOBALS['egw']->accounts->members($id, true));
} }
break; break;
default : default :

View File

@ -748,9 +748,10 @@ var et2_calendar_event = /** @class */ (function (_super) {
} }
if ((isNaN(parseInt(owner)) || parseInt(owner) < 0) && options && typeof options.find == "function") { if ((isNaN(parseInt(owner)) || parseInt(owner) < 0) && options && typeof options.find == "function") {
var resource = options.find(function (element) { var resource = options.find(function (element) {
return element.id == owner && element.resources; return element.id == owner;
}) || {}; }) || {};
var matching_participant = (_a = resource) === null || _a === void 0 ? void 0 : _a.resources.filter(function (id) { return typeof event.participants[id] != "undefined"; }); var matching_participant = typeof resource.resources == "undefined" ?
resource : (_a = resource) === null || _a === void 0 ? void 0 : _a.resources.filter(function (id) { return typeof event.participants[id] != "undefined"; });
if (matching_participant.length > 0) { if (matching_participant.length > 0) {
return this._status_check(event, filter, matching_participant); return this._status_check(event, filter, matching_participant);
} }

View File

@ -965,9 +965,11 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
{ {
let resource = options.find(function (element) let resource = options.find(function (element)
{ {
return element.id == owner && element.resources; return element.id == owner;
}) || {}; }) || {};
let matching_participant = resource?.resources.filter(id => typeof event.participants[id] != "undefined"); let matching_participant = typeof resource.resources == "undefined" ?
resource :
resource?.resources.filter(id => typeof event.participants[id] != "undefined");
if(matching_participant.length > 0) if(matching_participant.length > 0)
{ {
return this._status_check(event, filter, matching_participant); return this._status_check(event, filter, matching_participant);