Skip to content

Commit

Permalink
Merge pull request #10090 from nextcloud/backport/10024/stable3.7
Browse files Browse the repository at this point in the history
[stable3.7] fix: wrong attendance status for imip events
  • Loading branch information
kesselb authored Sep 4, 2024
2 parents 9329bf2 + d5f6a1e commit 1e0164b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default {
this.sync()
await this.$store.dispatch('fetchCurrentUserPrincipal')
await this.$store.dispatch('loadCollections')
this.$store.commit('hasCurrentUserPrincipalAndCollections', true)
},
methods: {
reload() {
Expand Down
12 changes: 3 additions & 9 deletions src/components/Imip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export default {
computed: {
...mapGetters({
currentUserPrincipalEmail: 'getCurrentUserPrincipalEmail',
clonedCalendars: 'getClonedCalendars',
clonedWriteableCalendars: 'getClonedWriteableCalendars',
}),
/**
Expand Down Expand Up @@ -379,7 +379,7 @@ export default {
}
}
return this.clonedCalendars
return this.clonedWriteableCalendars
.map(getCalendarData)
.filter(props => props.components.vevent && props.writable === true)
},
Expand All @@ -391,12 +391,6 @@ export default {
await this.fetchExistingEvent(this.attachedVEvent.uid)
},
},
clonedCalendars: {
immediate: true,
async handler() {
await this.fetchExistingEvent(this.attachedVEvent.uid)
},
},
calendarsForPicker: {
immediate: true,
handler(calendarsForPicker) {
Expand Down Expand Up @@ -493,7 +487,7 @@ export default {
// TODO: can this query be reduced to a single request?
const limit = pLimit(5)
const promises = this.clonedCalendars.map(async (calendar) => {
const promises = this.clonedWriteableCalendars.map(async (calendar) => {
// Query adapted from https://datatracker.ietf.org/doc/html/rfc4791#section-7.8.6
return limit(() => calendar.calendarQuery([{
name: [NS.IETF_CALDAV, 'comp-filter'],
Expand Down
5 changes: 4 additions & 1 deletion src/components/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<div v-if="itineraries.length > 0" class="message-itinerary">
<Itinerary :entries="itineraries" :message-id="message.messageId" />
</div>
<div v-if="message.scheduling.length > 0" class="message-imip">
<div v-if="hasCurrentUserPrincipalAndCollections && message.scheduling.length > 0" class="message-imip">
<Imip v-for="scheduling in message.scheduling"
:key="scheduling.id"
:scheduling="scheduling" />
Expand Down Expand Up @@ -144,6 +144,9 @@ export default {
itineraries() {
return this.message.itineraries ?? []
},
hasCurrentUserPrincipalAndCollections() {
return this.$store.getters.hasCurrentUserPrincipalAndCollections
},
},
methods: {
onReply(replyBody = '') {
Expand Down
5 changes: 4 additions & 1 deletion src/store/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ export const getters = {
getCurrentUserPrincipal: (state) => state.currentUserPrincipal,
getCurrentUserPrincipalEmail: (state) => state.currentUserPrincipal?.email,
getCalendars: (state) => state.calendars,
getClonedCalendars: (state) => state.calendars.map(calendar => {
getClonedWriteableCalendars: (state) => state.calendars.filter(calendar => {
return calendar.isWriteable()
}).map(calendar => {
// Hack: We need to clone all calendars because some methods (e.g. calendarQuery) are
// unnecessarily mutating the object and causing vue warnings (if used outside of
// mutations).
Expand Down Expand Up @@ -157,4 +159,5 @@ export const getters = {
},
isOneLineLayout: (state) => state.list,
hasFetchedInitialEnvelopes: (state) => state.hasFetchedInitialEnvelopes,
hasCurrentUserPrincipalAndCollections: (state) => state.hasCurrentUserPrincipalAndCollections,
}
1 change: 1 addition & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default new Store({
calendars: [],
smimeCertificates: [],
hasFetchedInitialEnvelopes: false,
hasCurrentUserPrincipalAndCollections: false,
},
getters,
mutations,
Expand Down
3 changes: 3 additions & 0 deletions src/store/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,4 +512,7 @@ export default {
setHasFetchedInitialEnvelopes(state, hasFetchedInitialEnvelopes) {
state.hasFetchedInitialEnvelopes = hasFetchedInitialEnvelopes
},
hasCurrentUserPrincipalAndCollections(state, hasCurrentUserPrincipalAndCollections) {
state.hasCurrentUserPrincipalAndCollections = hasCurrentUserPrincipalAndCollections
},
}

0 comments on commit 1e0164b

Please sign in to comment.