Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/Model/CalendarEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ public function getUID(): string {
return $this->event['UID'][0];
}

public function getBusy(): bool {
$transp = $this->event['TRANSP'][0] ?? '';
if ($transp === 'TRANSPARENT') {
return false;
}
return true;
}

public function getSummary(): string {
return $this->event['SUMMARY'][0];
}
Expand Down Expand Up @@ -236,6 +244,7 @@ public function jsonSerialize(): array {
'status' => $this->getStatus(),
'summary' => $this->getSummary(),
'type' => $this->getType(),
'busy' => $this->getBusy(),
];
}
}
4 changes: 0 additions & 4 deletions src/Api/modules/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ const calendar = {
tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
time: +new Date(),
},
cancelToken:
cancelTokenHandlerObject[
this.getEvents.name
].handleRequestCancellation().token,
})
},
}
Expand Down
5 changes: 5 additions & 0 deletions src/components/Calendar/CalendarInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ const conflictLevel = computed(() => {
return 'conflict-no'
}

// No conflict, if calendarEvent is available (not busy)
if (!calendarEvent.busy) {
return 'conflict-no'
}

// No conflict, if calendarEvent ends before option
if (calendarEvent.end <= option.timestamp) {
return 'conflict-no'
Expand Down
22 changes: 16 additions & 6 deletions src/components/Calendar/CalendarPeek.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import { CalendarAPI } from '../../Api/index.ts'
import { Logger } from '../../helpers/index.ts'
import { Option } from '../../Types/index.ts'
import { AxiosError } from '@nextcloud/axios'
import AlertIcon from 'vue-material-design-icons/Alert.vue'
import CalendarIcon from 'vue-material-design-icons/Calendar.vue'
import { NcButton } from '@nextcloud/vue'

export type CalendarEvent = {
id: number
Expand All @@ -35,6 +36,7 @@ export type CalendarEvent = {
status: string
summary: string
type: string
busy: boolean
}

const { option } = defineProps<{ option: Option }>()
Expand Down Expand Up @@ -78,6 +80,7 @@ const currentEvent = computed(
status: 'self',
summary: pollStore.configuration.title,
type: detectAllDay.value.type,
busy: false,
}),
)

Expand All @@ -95,12 +98,19 @@ onMounted(async () => {
</script>

<template>
<NcPopover v-if="events.length" v-bind="$attrs" class="calendar-peek">
<NcPopover
v-if="events.length"
v-bind="$attrs"
class="calendar-peek"
close-on-click-outside>
<template #trigger>
<AlertIcon
fill-color="var(--color-warning)"
:size="24"
:title="t('polls', 'Possible calendar conflicts')" />
<NcButton variant="tertiary-no-background">
<template #icon>
<CalendarIcon
:size="24"
:title="t('polls', 'Possibly affected calendar events')" />
</template>
</NcButton>
</template>
<div class="calendar-peek__grid">
<CalendarInfo
Expand Down