Skip to content

Commit

Permalink
feat: add organizer selection
Browse files Browse the repository at this point in the history
Signed-off-by: SebastianKrupinski <[email protected]>
  • Loading branch information
SebastianKrupinski committed Aug 27, 2024
1 parent 0167c38 commit 0404ac8
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 28 deletions.
51 changes: 35 additions & 16 deletions src/components/Editor/Invitees/InviteesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,21 +250,7 @@ export default {
return organizers
},
organizerSelected() {
let organizer = null
if (this.calendarObjectInstance.organizer !== null) {
const user = this.calendarObjectInstance.organizer
organizer = {
label: user.commonName,
address: removeMailtoPrefix(user.uri)
}
} else if (this.principalsStore.getCurrentUserPrincipal !== null) {
const user = this.principalsStore.getCurrentUserPrincipal
organizer = {
label: user.displayname,
address: user.emailAddress
}
}
return organizer
return this.selectedOrganizer
},
isListEmpty() {
return !this.calendarObjectInstance.organizer && this.invitees.length === 0
Expand Down Expand Up @@ -318,7 +304,40 @@ export default {
},
},
methods: {
changeOrganizer({ id, address, label }) {
selectedOrganizer() {
let organizer = null
if (this.calendarObjectInstance.organizer !== null) {
const user = this.calendarObjectInstance.organizer
organizer = {
label: user.commonName,
address: removeMailtoPrefix(user.uri)
}
} else if (this.principalsStore.getCurrentUserPrincipal !== null) {
const user = this.principalsStore.getCurrentUserPrincipal
organizer = {
label: user.displayname,
address: user.emailAddress
}
}
return organizer
},
changeOrganizer({ id, address, label }, attend) {
if (attend === true) {
const current = this.selectedOrganizer()
this.calendarObjectInstanceStore.addAttendee({
calendarObjectInstance: this.calendarObjectInstance,
commonName: current.label,
uri: current.address,
calendarUserType: 'INDIVIDUAL',
participationStatus: 'NEEDS-ACTION',
role: 'REQ-PARTICIPANT',
rsvp: true,
language: null,
timezoneId: null,
organizer: null,
member: null,
})
}
this.calendarObjectInstanceStore.setOrganizer({
calendarObjectInstance: this.calendarObjectInstance,
commonName: label,
Expand Down
32 changes: 20 additions & 12 deletions src/components/Editor/Invitees/OrganizerListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,24 @@
</div>
<div class="invitees-list-item__actions">
<NcActions v-if="!isReadOnly && isSharedWithMe">
<NcActionButton v-for="person in organizerSelection"
v-show="!selectedOrganizer(person.address)"
:key="person.address"
:closeAfterClick = "true"
@click="changeOrganizer(person)">
<template #icon>
<Crown :size="20" />
</template>
{{ $t('calendar', 'Make {label} the organizer', {label: person.label}) }}
</NcActionButton>
<template v-for="person in organizerSelection">
<NcActionButton v-show="!selectedOrganizer(person.address)"
:closeAfterClick = "true"
@click="changeOrganizer(person, false)">
<template #icon>
<Crown :size="20" />
</template>
{{ $t('calendar', 'Make {label} the organizer', {label: person.label}) }}
</NcActionButton>
<NcActionButton v-show="!selectedOrganizer(person.address)"
:closeAfterClick = "true"
@click="changeOrganizer(person, true)">
<template #icon>
<Crown :size="20" />
</template>
{{ $t('calendar', 'Make {label} the organizer and attend', {label: person.label}) }}
</NcActionButton>
</template>
</NcActions>
</div>
</div>
Expand Down Expand Up @@ -106,8 +114,8 @@ export default {
}
return false
},
changeOrganizer(person) {
this.$emit('change-organizer', person)
changeOrganizer(person, attend) {
this.$emit('change-organizer', person, attend)
},
},
}
Expand Down

0 comments on commit 0404ac8

Please sign in to comment.