559 delegation create event in another user calendar (#561)
* [#559] added delegated calendars in user selector * [#559] selector for calendar display delegated and personal separatly Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
@@ -76,14 +76,17 @@ function EventUpdateModal({
|
||||
|
||||
const user = useAppSelector((state) => state.user);
|
||||
|
||||
const calendarsList = useAppSelector((state) => state.calendars.list);
|
||||
|
||||
// if the event's calendar is delegated then it shall be the only calendar accessible from the event update modal
|
||||
const userPersonalCalendars: Calendar[] = useMemo(() => {
|
||||
const allCalendars = Object.values(calendarsList) as Calendar[];
|
||||
const allCalendars = Object.values(calList) as Calendar[];
|
||||
if (calList[calId]?.delegated) {
|
||||
return [calList[calId]];
|
||||
}
|
||||
return allCalendars.filter(
|
||||
(c: Calendar) => c.id?.split("/")[0] === user.userData?.openpaasId
|
||||
(calendar: Calendar) =>
|
||||
calendar.id?.split("/")[0] === user.userData?.openpaasId
|
||||
);
|
||||
}, [calendarsList, user.userData?.openpaasId]);
|
||||
}, [calList, calId, user.userData?.openpaasId]);
|
||||
|
||||
const timezoneList = useMemo(() => {
|
||||
const zones = Object.keys(TIMEZONES.zones).sort();
|
||||
@@ -275,7 +278,7 @@ function EventUpdateModal({
|
||||
|
||||
// Handle repetition properly - check both current event and base event
|
||||
const baseEventId = extractEventBaseUuid(eventToDisplay.uid);
|
||||
const baseEvent = calendarsList[calId]?.events[baseEventId];
|
||||
const baseEvent = calList[calId]?.events[baseEventId];
|
||||
const repetitionSource =
|
||||
eventToDisplay.repetition || baseEvent?.repetition;
|
||||
|
||||
@@ -343,7 +346,7 @@ function EventUpdateModal({
|
||||
event,
|
||||
calId,
|
||||
userPersonalCalendars,
|
||||
calendarsList,
|
||||
calList,
|
||||
masterEvent,
|
||||
isLoadingMasterEvent,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user