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 7fcf77c commit 1b0a8c9
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
},

Check warning on line 254 in src/components/Editor/Invitees/InviteesList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Invitees/InviteesList.vue#L254

Added line #L254 was not covered by tests
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) {

Check warning on line 309 in src/components/Editor/Invitees/InviteesList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Invitees/InviteesList.vue#L308-L309

Added lines #L308 - L309 were not covered by tests
const user = this.calendarObjectInstance.organizer
organizer = {
label: user.commonName,

Check warning on line 312 in src/components/Editor/Invitees/InviteesList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Invitees/InviteesList.vue#L311-L312

Added lines #L311 - L312 were not covered by tests
address: removeMailtoPrefix(user.uri)
}
} else if (this.principalsStore.getCurrentUserPrincipal !== null) {
const user = this.principalsStore.getCurrentUserPrincipal

Check warning on line 316 in src/components/Editor/Invitees/InviteesList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Invitees/InviteesList.vue#L314-L316

Added lines #L314 - L316 were not covered by tests
organizer = {
label: user.displayname,
address: user.emailAddress
}

Check warning on line 320 in src/components/Editor/Invitees/InviteesList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Invitees/InviteesList.vue#L318-L320

Added lines #L318 - L320 were not covered by tests
}
return organizer
},
changeOrganizer({ id, address, label }, attend) {

Check warning on line 324 in src/components/Editor/Invitees/InviteesList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Invitees/InviteesList.vue#L323-L324

Added lines #L323 - L324 were not covered by tests
if (attend === true) {
const current = this.selectedOrganizer()
this.calendarObjectInstanceStore.addAttendee({
calendarObjectInstance: this.calendarObjectInstance,
commonName: current.label,
uri: current.address,

Check warning on line 330 in src/components/Editor/Invitees/InviteesList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Invitees/InviteesList.vue#L330

Added line #L330 was not covered by tests
calendarUserType: 'INDIVIDUAL',
participationStatus: 'NEEDS-ACTION',
role: 'REQ-PARTICIPANT',
rsvp: true,
language: null,

Check warning on line 335 in src/components/Editor/Invitees/InviteesList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Invitees/InviteesList.vue#L334-L335

Added lines #L334 - L335 were not covered by tests
timezoneId: null,
organizer: null,

Check warning on line 337 in src/components/Editor/Invitees/InviteesList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Invitees/InviteesList.vue#L337

Added line #L337 was not covered by tests
member: null,
})
}
this.calendarObjectInstanceStore.setOrganizer({
calendarObjectInstance: this.calendarObjectInstance,

Check warning on line 342 in src/components/Editor/Invitees/InviteesList.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Invitees/InviteesList.vue#L341-L342

Added lines #L341 - L342 were not covered by tests
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)"

Check failure on line 24 in src/components/Editor/Invitees/OrganizerListItem.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Custom elements in iteration require 'v-bind:key' directives
: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)"

Check failure on line 32 in src/components/Editor/Invitees/OrganizerListItem.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Custom elements in iteration require 'v-bind:key' directives
:closeAfterClick = "true"
@click="changeOrganizer(person, true)">
<template #icon>
<Crown :size="20" />
</template>

Check warning on line 37 in src/components/Editor/Invitees/OrganizerListItem.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor/Invitees/OrganizerListItem.vue#L36-L37

Added lines #L36 - L37 were not covered by tests
{{ $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 1b0a8c9

Please sign in to comment.