-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5396 from onny/circle-invite
- Loading branch information
Showing
6 changed files
with
303 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
<!-- | ||
- @copyright Copyright (c) 2019 Georg Ehrke <oc.list@georgehrke.com> | ||
- @copyright Copyright (c) 2023 Jonas Heinrich <[email protected]> | ||
- | ||
- @author Georg Ehrke <[email protected]> | ||
- @author Jonas Heinrich <[email protected]> | ||
|
||
- | ||
- @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, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
<!-- | ||
- @copyright Copyright (c) 2019 Georg Ehrke <oc.list@georgehrke.com> | ||
- @copyright Copyright (c) 2023 Jonas Heinrich <[email protected]> | ||
- | ||
- @author Georg Ehrke <[email protected]> | ||
- @author Richard Steinmetz <[email protected]> | ||
- @author Jonas Heinrich <[email protected]> | ||
- | ||
- @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, | ||
|
Oops, something went wrong.