-
-
-
- {{ t('calendar', 'Invitation accepted') }}
-
-
-
-
-
- {{ t('calendar', 'Available') }}
-
-
-
-
-
- {{ t('calendar', 'Suggested') }}
-
-
-
-
-
- {{ t('calendar', 'Participation marked as tentative') }}
-
-
-
-
-
- {{ t('calendar', 'Accepted {organizerName}\'s invitation', {
- organizerName: organizerDisplayName,
- }) }}
-
-
-
-
-
- {{ t('calendar', 'Not available') }}
-
-
-
-
-
- {{ t('calendar', 'Invitation declined') }}
-
-
-
-
-
- {{ t('calendar', 'Declined {organizerName}\'s invitation', {
- organizerName: organizerDisplayName,
- }) }}
-
-
-
-
-
- {{ t('calendar', 'Invitation is delegated') }}
-
-
-
-
-
- {{ t('calendar', 'Checking availability') }}
-
-
-
-
-
- {{ t('calendar', 'Awaiting response') }}
-
-
-
-
-
- {{ t('calendar', 'Has not responded to {organizerName}\'s invitation yet', {
- organizerName: organizerDisplayName,
- }) }}
-
-
+
+
+ {{ status.text }}
+
@@ -132,7 +44,6 @@ export default {
IconNoResponse,
IconClose,
IconDelegated,
-
},
props: {
avatarLink: {
@@ -143,6 +54,10 @@ export default {
type: String,
required: true,
},
+ scheduleStatus: {
+ type: String,
+ required: false,
+ },
commonName: {
type: String,
required: true,
@@ -172,6 +87,145 @@ export default {
required: true,
},
},
+ computed: {
+ /**
+ * @return {icon: object, fillColor: string|undefined, text: string}
+ */
+ status() {
+ const acceptedIcon = {
+ icon: IconCheck,
+ fillColor: '#32CD32',
+ }
+ const declinedIcon = {
+ icon: IconClose,
+ fillColor: '#ff4402',
+ }
+
+ if (this.isSuggestion) {
+ return {
+ ...acceptedIcon,
+ text: t('calendar', 'Suggested'),
+ }
+ }
+
+ // Try to use the participation status first
+ switch (this.participationStatus) {
+ case 'ACCEPTED':
+ if (this.isResource) {
+ return {
+ ...acceptedIcon,
+ text: t('calendar', 'Available'),
+ }
+ }
+
+ if (this.attendeeIsOrganizer && !this.isViewedByOrganizer) {
+ return {
+ ...acceptedIcon,
+ text: t('calendar', 'Invited you'),
+ }
+ }
+
+ if (this.isViewedByOrganizer) {
+ return {
+ ...acceptedIcon,
+ text: t('calendar', 'Invitation accepted'),
+ }
+ }
+
+ return {
+ ...acceptedIcon,
+ text: t('calendar', 'Accepted {organizerName}\'s invitation', {
+ organizerName: this.organizerDisplayName,
+ }),
+ }
+ case 'TENTATIVE':
+ return {
+ ...acceptedIcon,
+ text: t('calendar', 'Participation marked as tentative'),
+ }
+ case 'DELEGATED':
+ return {
+ icon: IconDelegated,
+ text: t('calendar', 'Invitation is delegated'),
+ }
+ case 'DECLINED':
+ if (this.isResource) {
+ return {
+ ...declinedIcon,
+ text: t('calendar', 'Not available'),
+ }
+ }
+
+ if (this.isViewedByOrganizer) {
+ return {
+ ...declinedIcon,
+ text: t('calendar', 'Invitation declined'),
+ }
+ }
+
+ return {
+ ...declinedIcon,
+ text: t('calendar', 'Declined {organizerName}\'s invitation', {
+ organizerName: this.organizerDisplayName,
+ }),
+ }
+ }
+
+ // Schedule status is only present on the original event of the organizer
+ // TODO: Is this a bug or compliant with RFCs?
+ if (this.isViewedByOrganizer) {
+ // No status or status 1.0 indicate that the invitation is pending
+ if (!this.scheduleStatus || this.scheduleStatus === '1.0') {
+ if (this.isResource) {
+ return {
+ icon: IconNoResponse,
+ text: t('calendar', 'Availability will be checked'),
+ }
+ }
+
+ return {
+ icon: IconNoResponse,
+ text: t('calendar', 'Invitation will be sent'),
+ }
+ }
+
+ // Status 3.7, 3.8, 5.1, 5.2 and 5.3 indicate delivery failures.
+ // Could be due to insufficient permissions or some temporary failure.
+ if (this.scheduleStatus[0] === '3' || this.scheduleStatus[0] === '5') {
+ if (this.isResource) {
+ return {
+ icon: IconNoResponse,
+ text: t('calendar', 'Failed to check availability'),
+ }
+ }
+
+ return {
+ icon: IconNoResponse,
+ text: t('calendar', 'Failed to deliver invitation'),
+ }
+ }
+
+ return {
+ icon: IconNoResponse,
+ text: t('calendar', 'Awaiting response'),
+ }
+ }
+
+ if (this.isResource) {
+ return {
+ icon: IconNoResponse,
+ text: t('calendar', 'Checking availability'),
+ }
+ }
+
+ return {
+ icon: IconNoResponse,
+ text: t('calendar', 'Has not responded to {organizerName}\'s invitation yet', {
+ organizerName: this.organizerDisplayName,
+ }),
+ }
+ },
+ },
}