From 05a4fc2758f14a3d49694188f8e1db06046cd4bf Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 8 Dec 2022 14:26:17 -0700 Subject: [PATCH] Fix missing / doubled calendar owners in sidemenu --- .../inc/class.calendar_owner_etemplate_widget.inc.php | 2 +- calendar/js/CalendarOwner.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/calendar/inc/class.calendar_owner_etemplate_widget.inc.php b/calendar/inc/class.calendar_owner_etemplate_widget.inc.php index b93c308be2..a9f9684f6b 100644 --- a/calendar/inc/class.calendar_owner_etemplate_widget.inc.php +++ b/calendar/inc/class.calendar_owner_etemplate_widget.inc.php @@ -299,7 +299,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist $type = $data['type']; $value = array( - 'value' => substr($id, 0, -1) == $type ? $id : $type . $id, + 'value' => substr($id, 0, 1) == $type ? $id : $type . $id, 'label' => $title, 'app' => lang($data['app']) ); diff --git a/calendar/js/CalendarOwner.ts b/calendar/js/CalendarOwner.ts index 3f23a603fb..09775c2eed 100644 --- a/calendar/js/CalendarOwner.ts +++ b/calendar/js/CalendarOwner.ts @@ -79,13 +79,14 @@ export class CalendarOwner extends Et2Select } // Put it in the list of options let index = this.select_options.findIndex(o => o.value == owner); - if(index !== -1) + let remote_index = this._selected_remote.findIndex(o => o.value == owner); + if(remote_index !== -1) { - this.select_options[index] = data[owner]; + this._selected_remote[remote_index] = data[owner]; } - else + else if(index == -1) { - this.select_options.push(data[owner]); + this._selected_remote.push(data[owner]); } } this.requestUpdate("select_options");