mirror of https://github.com/nextcloud/calendar
feat: Ability to render groups as attendees
Implement ability to render groups and group members as attendees of an calendar event. This is implemented by reading and interpreting the CUTYPE and MEMBER parameter of the iCal ATTENDEE attribute. For example attendee "user1" belongs to a group identified with the uri mygroup@localhost: "ATTENDEE;MEMBER="mailto:mygroup@localhost";CN=user1;[...]". The group entity is also a ATTENDEE entry but with "CUTYPE=GROUP" and with the corresponding uri mygroup@localhost: "ATTENDEE;CN=MyGroup;CUTYPE=GROUP;[...]:mailto:mygroup@localhost". In the frontend, groups will be displayed as a collapsible list whereas members of the group will be displayed with the same functionality as normal attendees. In case the group entry gets deleted, all of its members will get removed too. Empty groups with no members might be present in the iCal file but won't get rendered. According to the iCal specifications, groups can have more than one uri and attendees could have multiple membership addresses in one attribute. This is neither covered yet in calendar-js nor in this PR. Signed-off-by: Jonas Heinrich <heinrich@synyx.de>
This commit is contained in:
parent
6b75db11c0
commit
33e236c285
|
@ -1,7 +1,10 @@
|
|||
<!--
|
||||
- @copyright Copyright (c) 2019 Georg Ehrke <oc.list@georgehrke.com>
|
||||
- @copyright Copyright (c) 2023 Jonas Heinrich <heinrich@synyx.net>
|
||||
-
|
||||
- @author Georg Ehrke <oc.list@georgehrke.com>
|
||||
- @author Jonas Heinrich <heinrich@synyx.net>
|
||||
|
||||
-
|
||||
- @license AGPL-3.0-or-later
|
||||
-
|
||||
|
@ -22,110 +25,119 @@
|
|||
|
||||
<template>
|
||||
<div class="avatar-participation-status">
|
||||
<Avatar :disable-tooltip="true"
|
||||
<Avatar v-if="isGroup">
|
||||
<template #icon>
|
||||
<AccountMultiple :size="28" />
|
||||
</template>
|
||||
</Avatar>
|
||||
<Avatar v-else
|
||||
:disable-tooltip="true"
|
||||
:user="commonName"
|
||||
:display-name="commonName"
|
||||
:is-no-user="true" />
|
||||
<template v-if="participationStatus === 'ACCEPTED' && isViewedByOrganizer">
|
||||
<IconCheck class="avatar-participation-status__indicator"
|
||||
fill-color="#32CD32"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Invitation accepted') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isResource && participationStatus === 'ACCEPTED'">
|
||||
<IconCheck class="avatar-participation-status__indicator"
|
||||
fill-color="#32CD32"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Available') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isSuggestion">
|
||||
<IconCheck class="avatar-participation-status__indicator"
|
||||
fill-color="#32CD32"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Suggested') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="participationStatus === 'TENTATIVE'">
|
||||
<IconCheck class="avatar-participation-status__indicator"
|
||||
fill-color="#32CD32"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Participation marked as tentative') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="participationStatus === 'ACCEPTED' && !isViewedByOrganizer">
|
||||
<IconCheck class="avatar-participation-status__indicator"
|
||||
fill-color="#32CD32"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Accepted {organizerName}\'s invitation', {
|
||||
organizerName: organizerDisplayName,
|
||||
}) }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isResource && participationStatus === 'DECLINED'">
|
||||
<IconClose class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Not available') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="participationStatus === 'DECLINED' && isViewedByOrganizer">
|
||||
<IconClose class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Invitation declined') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="participationStatus === 'DECLINED' && !isViewedByOrganizer">
|
||||
<IconClose class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Declined {organizerName}\'s invitation', {
|
||||
organizerName: organizerDisplayName,
|
||||
}) }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="participationStatus === 'DELEGATED'">
|
||||
<IconDelegated class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Invitation is delegated') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isResource">
|
||||
<IconNoResponse class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Checking availability') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isViewedByOrganizer">
|
||||
<IconNoResponse class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Invitation sent') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<IconNoResponse class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Has not responded to {organizerName}\'s invitation yet', {
|
||||
organizerName: organizerDisplayName,
|
||||
}) }}
|
||||
</div>
|
||||
<template v-if="!isGroup">
|
||||
<template v-if="participationStatus === 'ACCEPTED' && isViewedByOrganizer">
|
||||
<IconCheck class="avatar-participation-status__indicator"
|
||||
fill-color="#32CD32"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Invitation accepted') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isResource && participationStatus === 'ACCEPTED'">
|
||||
<IconCheck class="avatar-participation-status__indicator"
|
||||
fill-color="#32CD32"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Available') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isSuggestion">
|
||||
<IconCheck class="avatar-participation-status__indicator"
|
||||
fill-color="#32CD32"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Suggested') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="participationStatus === 'TENTATIVE'">
|
||||
<IconCheck class="avatar-participation-status__indicator"
|
||||
fill-color="#32CD32"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Participation marked as tentative') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="participationStatus === 'ACCEPTED' && !isViewedByOrganizer">
|
||||
<IconCheck class="avatar-participation-status__indicator"
|
||||
fill-color="#32CD32"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Accepted {organizerName}\'s invitation', {
|
||||
organizerName: organizerDisplayName,
|
||||
}) }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isResource && participationStatus === 'DECLINED'">
|
||||
<IconClose class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Not available') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="participationStatus === 'DECLINED' && isViewedByOrganizer">
|
||||
<IconClose class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Invitation declined') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="participationStatus === 'DECLINED' && !isViewedByOrganizer">
|
||||
<IconClose class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Declined {organizerName}\'s invitation', {
|
||||
organizerName: organizerDisplayName,
|
||||
}) }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="participationStatus === 'DELEGATED'">
|
||||
<IconDelegated class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Invitation is delegated') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isResource">
|
||||
<IconNoResponse class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Checking availability') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isViewedByOrganizer">
|
||||
<IconNoResponse class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Invitation sent') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<IconNoResponse class="avatar-participation-status__indicator"
|
||||
:size="20" />
|
||||
<div class="avatar-participation-status__text">
|
||||
{{ t('calendar', 'Has not responded to {organizerName}\'s invitation yet', {
|
||||
organizerName: organizerDisplayName,
|
||||
}) }}
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { NcAvatar as Avatar } from '@nextcloud/vue'
|
||||
import AccountMultiple from 'vue-material-design-icons/AccountMultiple.vue'
|
||||
import IconCheck from 'vue-material-design-icons/CheckCircle.vue'
|
||||
import IconNoResponse from 'vue-material-design-icons/HelpCircle.vue'
|
||||
import IconClose from 'vue-material-design-icons/CloseCircle.vue'
|
||||
|
@ -134,8 +146,9 @@ import IconDelegated from 'vue-material-design-icons/ArrowRightDropCircle.vue'
|
|||
export default {
|
||||
name: 'AvatarParticipationStatus',
|
||||
components: {
|
||||
Avatar,
|
||||
IconCheck,
|
||||
Avatar,
|
||||
AccountMultiple,
|
||||
IconCheck,
|
||||
IconNoResponse,
|
||||
IconClose,
|
||||
IconDelegated,
|
||||
|
@ -162,6 +175,10 @@ export default {
|
|||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
isGroup: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
},
|
||||
isSuggestion: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<!--
|
||||
- @copyright Copyright (c) 2019 Georg Ehrke <oc.list@georgehrke.com>
|
||||
- @copyright Copyright (c) 2023 Jonas Heinrich <heinrich@synyx.net>
|
||||
-
|
||||
- @author Georg Ehrke <oc.list@georgehrke.com>
|
||||
- @author Richard Steinmetz <richard@steinmetz.cloud>
|
||||
- @author Jonas Heinrich <heinrich@synyx.net>
|
||||
-
|
||||
- @license AGPL-3.0-or-later
|
||||
-
|
||||
|
@ -34,6 +36,7 @@
|
|||
:attendee="invitee"
|
||||
:is-read-only="isReadOnly || isSharedWithMe"
|
||||
:organizer-display-name="organizerDisplayName"
|
||||
:members="invitee.members"
|
||||
@remove-attendee="removeAttendee" />
|
||||
<NoAttendeesView v-if="isReadOnly && isListEmpty"
|
||||
:message="noInviteesMessage" />
|
||||
|
@ -129,13 +132,51 @@ export default {
|
|||
return !['RESOURCE', 'ROOM'].includes(attendee.attendeeProperty.userType)
|
||||
})
|
||||
},
|
||||
groups() {
|
||||
return this.calendarObjectInstance.attendees.filter(attendee => {
|
||||
return attendee.attendeeProperty.userType === 'GROUP'
|
||||
})
|
||||
},
|
||||
inviteesWithoutOrganizer() {
|
||||
|
||||
if (!this.calendarObjectInstance.organizer) {
|
||||
return this.invitees
|
||||
}
|
||||
|
||||
return this.invitees
|
||||
.filter(attendee => attendee.uri !== this.calendarObjectInstance.organizer.uri)
|
||||
.filter(attendee => {
|
||||
// Filter attendees which are part of an invited group
|
||||
let isMemberOfGroup = false
|
||||
if (attendee.attendeeProperty.member) {
|
||||
isMemberOfGroup = this.groups.some(function(group) {
|
||||
return attendee.attendeeProperty.member.includes(group.uri)
|
||||
&& attendee.attendeeProperty.userType === 'INDIVIDUAL'
|
||||
})
|
||||
}
|
||||
|
||||
// Add attendee to group member list
|
||||
if (isMemberOfGroup) {
|
||||
this.groups.forEach(group => {
|
||||
if (attendee.member.includes(group.uri)) {
|
||||
if (!group.members) {
|
||||
group.members = []
|
||||
}
|
||||
group.members.push(attendee)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Check if attendee is an empty group
|
||||
let isEmptyGroup = attendee.attendeeProperty.userType === 'GROUP'
|
||||
this.invitees.forEach(invitee => {
|
||||
if (invitee.member && invitee.member.includes(attendee.uri)) {
|
||||
isEmptyGroup = false
|
||||
}
|
||||
})
|
||||
|
||||
return attendee.uri !== this.calendarObjectInstance.organizer.uri
|
||||
&& !isMemberOfGroup && !isEmptyGroup
|
||||
})
|
||||
},
|
||||
isOrganizer() {
|
||||
return this.calendarObjectInstance.organizer !== null
|
||||
|
@ -204,6 +245,19 @@ export default {
|
|||
})
|
||||
},
|
||||
removeAttendee(attendee) {
|
||||
// Remove attendee from participating group
|
||||
if (attendee.member) {
|
||||
this.groups.forEach(group => {
|
||||
if (attendee.member.includes(group.uri)) {
|
||||
group.members = group.members.filter(member => {
|
||||
if (!attendee.member.includes(group.uri)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
this.$store.commit('removeAttendee', {
|
||||
calendarObjectInstance: this.calendarObjectInstance,
|
||||
attendee,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<!--
|
||||
- @copyright Copyright (c) 2019 Georg Ehrke <oc.list@georgehrke.com>
|
||||
- @copyright Copyright (c) 2023 Jonas Heinrich <heinrich@synyx.net>
|
||||
-
|
||||
- @author Georg Ehrke <oc.list@georgehrke.com>
|
||||
- @author Richard Steinmetz <richard@steinmetz.cloud>
|
||||
- @author Jonas Heinrich <heinrich@synyx.net>
|
||||
-
|
||||
- @license AGPL-3.0-or-later
|
||||
-
|
||||
|
@ -29,11 +31,29 @@
|
|||
:avatar-link="avatarLink"
|
||||
:participation-status="attendee.participationStatus"
|
||||
:organizer-display-name="organizerDisplayName"
|
||||
:common-name="commonName" />
|
||||
<div class="invitees-list-item__displayname">
|
||||
:common-name="commonName"
|
||||
:is-group="isGroup" />
|
||||
<div class="invitees-list-item__displayname"
|
||||
:class="{ 'invitees-list-item__groupname':members.length }">
|
||||
{{ commonName }}
|
||||
<span v-if="members.length"
|
||||
class="invitees-list-item__member-count">
|
||||
({{ $n('calendar', '%n member', '%n members', members.length) }})
|
||||
</span>
|
||||
</div>
|
||||
<div class="invitees-list-item__actions">
|
||||
<NcButton v-if="members.length"
|
||||
class="icon-collapse"
|
||||
:class="{ 'icon-collapse--open':memberListExpaneded }"
|
||||
type="tertiary"
|
||||
@click="toggleMemberList">
|
||||
<template #icon>
|
||||
<ChevronUp v-if="memberListExpaneded"
|
||||
:size="20" />
|
||||
<ChevronDown v-else
|
||||
:size="20" />
|
||||
</template>
|
||||
</NcButton>
|
||||
<Actions v-if="isViewedByOrganizer">
|
||||
<ActionCheckbox :checked="attendee.rsvp"
|
||||
@change="toggleRSVP">
|
||||
|
@ -61,14 +81,25 @@
|
|||
{{ $t('calendar', 'Non-participant') }}
|
||||
</ActionRadio>
|
||||
|
||||
<ActionButton @click="removeAttendee">
|
||||
<ActionButton @click="removeAttendee(attendee)">
|
||||
<template #icon>
|
||||
<Delete :size="20" decorative />
|
||||
</template>
|
||||
{{ $t('calendar', 'Remove attendee') }}
|
||||
{{ removeAttendeeText }}
|
||||
</ActionButton>
|
||||
</Actions>
|
||||
</div>
|
||||
<div v-if="members.length"
|
||||
class="member-list"
|
||||
:class="{ 'member-list--open':memberListExpaneded }">
|
||||
<InviteesListItem v-for="member in members"
|
||||
:key="member.email"
|
||||
:attendee="member"
|
||||
:is-read-only="isReadOnly"
|
||||
:organizer-display-name="organizerDisplayName"
|
||||
:members="member.members"
|
||||
@remove-attendee="removeAttendee(member)" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -79,8 +110,11 @@ import {
|
|||
NcActionButton as ActionButton,
|
||||
NcActionRadio as ActionRadio,
|
||||
NcActionCheckbox as ActionCheckbox,
|
||||
NcButton,
|
||||
} from '@nextcloud/vue'
|
||||
import { removeMailtoPrefix } from '../../../utils/attendee.js'
|
||||
import ChevronDown from 'vue-material-design-icons/ChevronDown.vue'
|
||||
import ChevronUp from 'vue-material-design-icons/ChevronUp.vue'
|
||||
|
||||
import Delete from 'vue-material-design-icons/Delete.vue'
|
||||
|
||||
|
@ -93,6 +127,9 @@ export default {
|
|||
ActionRadio,
|
||||
Actions,
|
||||
Delete,
|
||||
NcButton,
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
},
|
||||
props: {
|
||||
attendee: {
|
||||
|
@ -107,6 +144,16 @@ export default {
|
|||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
members: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
memberListExpaneded: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
/**
|
||||
|
@ -116,6 +163,16 @@ export default {
|
|||
// return this.$store.getters.getAvatarForContact(this.uri) || this.commonName
|
||||
return this.commonName
|
||||
},
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
removeAttendeeText() {
|
||||
if (this.isGroup) {
|
||||
return this.$t('calendar', 'Remove group')
|
||||
} else {
|
||||
return this.$t('calendar', 'Remove attendee')
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Common name of the organizer or the uri without the 'mailto:' prefix.
|
||||
*
|
||||
|
@ -151,6 +208,9 @@ export default {
|
|||
// TODO: check if also viewed by organizer
|
||||
return !this.isReadOnly
|
||||
},
|
||||
isGroup() {
|
||||
return this.attendee.attendeeProperty.userType === 'GROUP'
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
|
@ -174,15 +234,30 @@ export default {
|
|||
},
|
||||
/**
|
||||
* Removes an attendee from the event
|
||||
*
|
||||
* @param {object} attendee Attendee object to remove
|
||||
*/
|
||||
removeAttendee() {
|
||||
this.$emit('remove-attendee', this.attendee)
|
||||
removeAttendee(attendee) {
|
||||
this.$emit('remove-attendee', attendee)
|
||||
},
|
||||
/**
|
||||
* Toggle member list if attendee is a group
|
||||
*/
|
||||
toggleMemberList() {
|
||||
this.memberListExpaneded = !this.memberListExpaneded
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.invitees-list-item {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.invitees-list-item__actions {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.invitees-list-item__displayname {
|
||||
margin-bottom: 17px;
|
||||
text-overflow: ellipsis;
|
||||
|
@ -190,7 +265,33 @@ export default {
|
|||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.invitees-list-item__groupname {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.avatar-participation-status {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.invitees-list-item__member-count {
|
||||
color: var(--color-text-maxcontrast);
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.member-list {
|
||||
height: auto;
|
||||
max-height: 0;
|
||||
flex-basis: 100%;
|
||||
overflow: hidden;
|
||||
transition: all 0.3s ease;
|
||||
padding: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.member-list--open {
|
||||
max-height: 1000px;
|
||||
transition: all 0.3s ease;
|
||||
padding: 0 0 10px 15px;
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
/**
|
||||
* @copyright Copyright (c) 2020 Georg Ehrke
|
||||
* @copyright Copyright (c) 2023 Jonas Heinrich
|
||||
*
|
||||
* @author Georg Ehrke <oc.list@georgehrke.com>
|
||||
* @author Jonas Heinrich <heinrich@synyx.net>
|
||||
*
|
||||
* @license AGPL-3.0-or-later
|
||||
*
|
||||
|
@ -44,6 +46,8 @@ const getDefaultAttendeeObject = (props = {}) => Object.assign({}, {
|
|||
rsvp: false,
|
||||
// The uri of the attendee
|
||||
uri: null,
|
||||
// Member address of the attendee
|
||||
member: null,
|
||||
}, props)
|
||||
|
||||
/**
|
||||
|
@ -61,6 +65,7 @@ const mapAttendeePropertyToAttendeeObject = (attendeeProperty) => {
|
|||
role: attendeeProperty.role,
|
||||
rsvp: attendeeProperty.rsvp,
|
||||
uri: attendeeProperty.email,
|
||||
member: attendeeProperty.member,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
/**
|
||||
* @copyright Copyright (c) 2019 Georg Ehrke
|
||||
* @copyright Copyright (c) 2023 Jonas Heinrich
|
||||
*
|
||||
* @author Georg Ehrke <oc.list@georgehrke.com>
|
||||
* @author Jonas Heinrich <heinrich@synyx.net>
|
||||
*
|
||||
* @license AGPL-3.0-or-later
|
||||
*
|
||||
|
@ -482,6 +484,17 @@ const mutations = {
|
|||
removeAttendee(state, { calendarObjectInstance, attendee }) {
|
||||
calendarObjectInstance.eventComponent.removeAttendee(attendee.attendeeProperty)
|
||||
|
||||
// Also remove members if attendee is a group
|
||||
if (attendee.attendeeProperty.userType === 'GROUP') {
|
||||
attendee.members.forEach(function(member) {
|
||||
calendarObjectInstance.eventComponent.removeAttendee(member.attendeeProperty)
|
||||
const index = calendarObjectInstance.attendees.indexOf(member)
|
||||
if (index !== -1) {
|
||||
calendarObjectInstance.attendees.splice(index, 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const index = calendarObjectInstance.attendees.indexOf(attendee)
|
||||
if (index !== -1) {
|
||||
calendarObjectInstance.attendees.splice(index, 1)
|
||||
|
|
|
@ -28,6 +28,7 @@ describe('Test suite: Attendee model (models/attendee.js)', () => {
|
|||
expect(getDefaultAttendeeObject()).toEqual({
|
||||
attendeeProperty: null,
|
||||
commonName: null,
|
||||
member: null,
|
||||
calendarUserType: 'INDIVIDUAL',
|
||||
participationStatus: 'NEEDS-ACTION',
|
||||
role: 'REQ-PARTICIPANT',
|
||||
|
@ -43,6 +44,7 @@ describe('Test suite: Attendee model (models/attendee.js)', () => {
|
|||
})).toEqual({
|
||||
attendeeProperty: null,
|
||||
commonName: null,
|
||||
member: null,
|
||||
calendarUserType: 'INDIVIDUAL',
|
||||
participationStatus: 'ACCEPTED',
|
||||
role: 'REQ-PARTICIPANT',
|
||||
|
@ -59,6 +61,7 @@ describe('Test suite: Attendee model (models/attendee.js)', () => {
|
|||
expect(attendeeModel).toEqual({
|
||||
attendeeProperty,
|
||||
commonName: null,
|
||||
member: null,
|
||||
calendarUserType: 'INDIVIDUAL',
|
||||
participationStatus: 'NEEDS-ACTION',
|
||||
role: 'REQ-PARTICIPANT',
|
||||
|
@ -74,6 +77,7 @@ describe('Test suite: Attendee model (models/attendee.js)', () => {
|
|||
expect(attendeeModel).toEqual({
|
||||
attendeeProperty,
|
||||
commonName: null,
|
||||
member: null,
|
||||
calendarUserType: 'GROUP',
|
||||
participationStatus: 'NEEDS-ACTION',
|
||||
role: 'REQ-PARTICIPANT',
|
||||
|
@ -89,6 +93,7 @@ describe('Test suite: Attendee model (models/attendee.js)', () => {
|
|||
expect(attendeeModel).toEqual({
|
||||
attendeeProperty,
|
||||
commonName: null,
|
||||
member: null,
|
||||
calendarUserType: 'INDIVIDUAL',
|
||||
participationStatus: 'DECLINED',
|
||||
role: 'REQ-PARTICIPANT',
|
||||
|
@ -104,6 +109,7 @@ describe('Test suite: Attendee model (models/attendee.js)', () => {
|
|||
expect(attendeeModel).toEqual({
|
||||
attendeeProperty,
|
||||
commonName: null,
|
||||
member: null,
|
||||
calendarUserType: 'INDIVIDUAL',
|
||||
participationStatus: 'NEEDS-ACTION',
|
||||
role: 'CHAIR',
|
||||
|
@ -119,6 +125,7 @@ describe('Test suite: Attendee model (models/attendee.js)', () => {
|
|||
expect(attendeeModel).toEqual({
|
||||
attendeeProperty,
|
||||
commonName: 'Henry Cabot',
|
||||
member: null,
|
||||
calendarUserType: 'INDIVIDUAL',
|
||||
participationStatus: 'TENTATIVE',
|
||||
role: 'REQ-PARTICIPANT',
|
||||
|
@ -134,6 +141,7 @@ describe('Test suite: Attendee model (models/attendee.js)', () => {
|
|||
expect(attendeeModel).toEqual({
|
||||
attendeeProperty,
|
||||
commonName: 'The Big Cheese',
|
||||
member: null,
|
||||
calendarUserType: 'INDIVIDUAL',
|
||||
participationStatus: 'DELEGATED',
|
||||
role: 'NON-PARTICIPANT',
|
||||
|
@ -149,6 +157,7 @@ describe('Test suite: Attendee model (models/attendee.js)', () => {
|
|||
expect(attendeeModel).toEqual({
|
||||
attendeeProperty,
|
||||
commonName: 'Jane Doe',
|
||||
member: null,
|
||||
calendarUserType: 'INDIVIDUAL',
|
||||
participationStatus: 'ACCEPTED',
|
||||
role: 'REQ-PARTICIPANT',
|
||||
|
|
Loading…
Reference in New Issue