diff --git a/plugins/time-resources/src/components/CreateToDoPopup.svelte b/plugins/time-resources/src/components/CreateToDoPopup.svelte index e2acfa34a5..da35b5a09c 100644 --- a/plugins/time-resources/src/components/CreateToDoPopup.svelte +++ b/plugins/time-resources/src/components/CreateToDoPopup.svelte @@ -84,7 +84,6 @@ rank: makeRank(undefined, latestTodo?.rank) } ) - const _calendar = `${acc._id}_calendar` as Ref<Calendar> for (const slot of slots) { await ops.addCollection(time.class.WorkSlot, calendar.space.Calendar, id, time.class.ToDo, 'workslots', { eventId: generateEventId(), @@ -111,7 +110,7 @@ let _calendar: Ref<Calendar> = `${currentUser._id}_calendar` as Ref<Calendar> const q = createQuery() - q.query(calendar.class.ExternalCalendar, { default: true, members: currentUser._id }, (res) => { + q.query(calendar.class.ExternalCalendar, { default: true, hidden: false, createdBy: currentUser._id }, (res) => { if (res.length > 0) { _calendar = res[0]._id } diff --git a/plugins/time-resources/src/components/PlanView.svelte b/plugins/time-resources/src/components/PlanView.svelte index fddcf86ffe..8edc62242e 100644 --- a/plugins/time-resources/src/components/PlanView.svelte +++ b/plugins/time-resources/src/components/PlanView.svelte @@ -52,7 +52,7 @@ const date = e.detail.date.getTime() const currentUser = getCurrentAccount() as PersonAccount const extCalendar = await client.findOne(calendar.class.ExternalCalendar, { - members: currentUser._id, + createdBy: currentUser._id, hidden: false, default: true }) diff --git a/plugins/time-resources/src/components/TodoWorkslots.svelte b/plugins/time-resources/src/components/TodoWorkslots.svelte index 4f6501215c..6116352b66 100644 --- a/plugins/time-resources/src/components/TodoWorkslots.svelte +++ b/plugins/time-resources/src/components/TodoWorkslots.svelte @@ -55,7 +55,12 @@ const now = Date.now() const date = Math.ceil(now / (30 * 60 * 1000)) * (30 * 60 * 1000) const currentUser = getCurrentAccount() as PersonAccount - const _calendar = `${currentUser._id}_calendar` as Ref<Calendar> + const extCalendar = await client.findOne(calendar.class.ExternalCalendar, { + createdBy: currentUser._id, + hidden: false, + default: true + }) + const _calendar = extCalendar ? extCalendar._id : (`${currentUser._id}_calendar` as Ref<Calendar>) const dueDate = date + defaultDuration await client.addCollection(time.class.WorkSlot, calendar.space.Calendar, todo._id, todo._class, 'workslots', { eventId: generateEventId(),