Skip to content
Draft
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
40 changes: 40 additions & 0 deletions src/components/Editor/Invitees/InviteesListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@
</template>
</NcButton>
<Actions v-if="!isReadOnly && isViewedByOrganizer">
<ActionButton
v-if="canResendInvitation"
@click="resendInvitation(attendee)">
<template #icon>
<EmailSync :size="20" decorative />
</template>
{{ $t('calendar', 'Resend invitation') }}
</ActionButton>

<ActionCheckbox
v-if="!members.length"
:modelValue="attendee.rsvp"
Expand Down Expand Up @@ -113,6 +122,7 @@
</template>

<script>
import { showError, showSuccess } from '@nextcloud/dialogs'
import {
NcActionButton as ActionButton,
NcActionCheckbox as ActionCheckbox,
Expand All @@ -123,6 +133,7 @@ import {
import { mapState, mapStores } from 'pinia'
import ChevronDown from 'vue-material-design-icons/ChevronDown.vue'
import ChevronUp from 'vue-material-design-icons/ChevronUp.vue'
import EmailSync from 'vue-material-design-icons/EmailSyncOutline.vue'
import Delete from 'vue-material-design-icons/TrashCanOutline.vue'
import AvatarParticipationStatus from '../AvatarParticipationStatus.vue'
import AttendeeDisplay from './AttendeeDisplay.vue'
Expand All @@ -141,6 +152,7 @@ export default {
Delete,
NcButton,
ChevronDown,
EmailSync,
ChevronUp,
AttendeeDisplay,
},
Expand Down Expand Up @@ -173,9 +185,12 @@ export default {
},
},

emits: ['removeAttendee'],

data() {
return {
memberListExpaneded: false,
isResendingInvitation: false,
timezone: null,
}
},
Expand Down Expand Up @@ -234,6 +249,10 @@ export default {
isGroup() {
return this.attendee.attendeeProperty.userType === 'GROUP'
},

canResendInvitation() {
return !this.isReadOnly && this.isViewedByOrganizer && !this.members.length && !this.isGroup
},
},

watch: {
Expand Down Expand Up @@ -287,6 +306,27 @@ export default {
this.$emit('removeAttendee', attendee)
},

/**
* Resends the invitation to a single attendee.
*
* @param {object} attendee Attendee object
* @return {Promise<void>}
*/
async resendInvitation(attendee) {
if (this.isResendingInvitation) {
return
}

this.isResendingInvitation = true
try {
await this.calendarObjectInstanceStore.resendInvitationToAttendee({ attendee })
showSuccess(this.$t('calendar', 'Invitation resent'))
} catch {
showError(this.$t('calendar', 'Unable to resend invitation'))
}
this.isResendingInvitation = false
},

/**
* Toggle member list if attendee is a group
*/
Expand Down
30 changes: 30 additions & 0 deletions src/store/calendarObjectInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,36 @@ export default defineStore('calendarObjectInstance', {
}
},

/**
* Resends an invitation update to a single attendee.
*
* @param {object} data The destructuring object
* @param {object} data.attendee The attendee to resend the invitation to
* @return {Promise<void>}
*/
async resendInvitationToAttendee({ attendee }) {
if (!this.calendarObject?.existsOnServer || !attendee?.attendeeProperty) {
return
}

const calendarObjectsStore = useCalendarObjectsStore()
const attendeeProperty = attendee.attendeeProperty
const previousForceSend = attendeeProperty.getParameterFirstValue('SCHEDULE-FORCE-SEND')

// Ask the scheduling backend to send a fresh REQUEST to this attendee.
attendeeProperty.setParameter(new Parameter('SCHEDULE-FORCE-SEND', 'REQUEST'))

try {
await calendarObjectsStore.updateCalendarObject({ calendarObject: this.calendarObject })
} finally {
if (previousForceSend === null) {
attendeeProperty.deleteParameter('SCHEDULE-FORCE-SEND')
} else {
attendeeProperty.setParameter(new Parameter('SCHEDULE-FORCE-SEND', previousForceSend))
}
}
},

/**
* Duplicate calendar-object-instance
*
Expand Down
Loading