Skip to content

Commit

Permalink
feat: Allow any calendar the user has access to, to be selected for t…
Browse files Browse the repository at this point in the history
…he 'conflict' calendar

Signed-off-by: Patrick Robertson <[email protected]>
Signed-off-by: Richard Steinmetz <[email protected]>
  • Loading branch information
pjrobertson authored and st3iny committed Aug 6, 2024
1 parent 3dd8212 commit 67d1435
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/components/AppointmentConfigModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ export default {
...mapState(useSettingsStore, {
isTalkEnabled: 'talkEnabled',
}),
...mapState(useCalendarsStore, ['ownSortedCalendars']),
...mapState(useCalendarsStore, [
'ownSortedCalendars',
'allSortedCalendars',

Check warning on line 200 in src/components/AppointmentConfigModal.vue

View check run for this annotation

Codecov / codecov/patch

src/components/AppointmentConfigModal.vue#L198-L200

Added lines #L198 - L200 were not covered by tests
]),
...mapStores(useAppointmentConfigsStore, useCalendarsStore, useSettingsStore),
formTitle() {
if (this.isNew) {
Expand All @@ -222,12 +225,12 @@ export default {
},
selectableConflictCalendars() {
// The target calendar is always a conflict calendar, remove it from additional conflict calendars
return this.ownSortedCalendars.filter(calendar => calendar.url !== this.calendar.url)
return this.allSortedCalendars.filter(calendar => calendar.url !== this.calendar.url)
},
conflictCalendars() {
const freebusyUris = this.editing.calendarFreeBusyUris ?? []
return freebusyUris.map(uri => {
return this.ownSortedCalendars.find(cal => this.calendarUrlToUri(cal.url) === uri)
return this.allSortedCalendars.find(cal => this.calendarUrlToUri(cal.url) === uri)
})
},
defaultConfig() {
Expand Down
16 changes: 14 additions & 2 deletions src/store/calendars.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default defineStore('calendars', {
},

/**
* List of sorted calendars
* List of sorted writable calendars
*
* @param {object} state the store data
* @return {Array}
Expand All @@ -77,7 +77,7 @@ export default defineStore('calendars', {
},

/**
* List of sorted calendars owned by the principal
* List of sorted writable calendars owned by the principal
*
* @param {object} state the store data
* @return {Array}
Expand All @@ -90,6 +90,18 @@ export default defineStore('calendars', {
.sort((a, b) => a.order - b.order)
},

/**
* List all sorted calendars, including readonly
*
* @param {object} state the store data
* @return {Array}
*/
allSortedCalendars(state) {
return state.calendars
.filter(calendar => calendar.supportsEvents)
.sort((a, b) => a.order - b.order)

Check warning on line 102 in src/store/calendars.js

View check run for this annotation

Codecov / codecov/patch

src/store/calendars.js#L99-L102

Added lines #L99 - L102 were not covered by tests
},

hasTrashBin(state) {
return state.trashBin !== undefined && state.trashBin.retentionDuration !== 0
},
Expand Down

0 comments on commit 67d1435

Please sign in to comment.