Skip to content

Commit 8d2f0fb

Browse files
committed
Shared calendars shouldn't allow adding attendees if the calendar is not yours
Signed-off-by: greta <gretadoci@gmail.com>
1 parent a371db2 commit 8d2f0fb

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

src/components/Editor/Invitees/InviteesList.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,24 @@
2323

2424
<template>
2525
<div>
26-
<InviteesListSearch v-if="!isReadOnly && hasUserEmailAddress"
26+
<InviteesListSearch v-if="!isReadOnly && !isSharedWithMe && hasUserEmailAddress"
2727
:already-invited-emails="alreadyInvitedEmails"
2828
@add-attendee="addAttendee" />
2929
<OrganizerListItem v-if="hasOrganizer"
30-
:is-read-only="isReadOnly"
30+
:is-read-only="isReadOnly || isSharedWithMe"
3131
:organizer="calendarObjectInstance.organizer" />
3232
<InviteesListItem v-for="invitee in inviteesWithoutOrganizer"
3333
:key="invitee.email"
3434
:attendee="invitee"
35-
:is-read-only="isReadOnly"
35+
:is-read-only="isReadOnly || isSharedWithMe"
3636
:organizer-display-name="organizerDisplayName"
3737
@remove-attendee="removeAttendee" />
3838
<NoAttendeesView v-if="isReadOnly && isListEmpty"
3939
:message="noInviteesMessage" />
4040
<NoAttendeesView v-if="!isReadOnly && isListEmpty && hasUserEmailAddress"
4141
:message="noInviteesMessage" />
42+
<NoAttendeesView v-if="isSharedWithMe"
43+
:message="noOwnerMessage" />
4244
<OrganizerNoEmailError v-if="!isReadOnly && isListEmpty && !hasUserEmailAddress" />
4345

4446
<div class="invitees-list-button-group">
@@ -101,6 +103,10 @@ export default {
101103
type: Object,
102104
required: true,
103105
},
106+
isSharedWithMe: {
107+
type: Boolean,
108+
required: true,
109+
},
104110
},
105111
data() {
106112
return {
@@ -115,6 +121,9 @@ export default {
115121
noInviteesMessage() {
116122
return this.$t('calendar', 'No attendees yet')
117123
},
124+
noOwnerMessage() {
125+
return this.$t('calendar', 'You don\'t own this calendar, so you cannot add attendees to this event')
126+
},
118127
invitees() {
119128
return this.calendarObjectInstance.attendees.filter(attendee => {
120129
return !['RESOURCE', 'ROOM'].includes(attendee.attendeeProperty.userType)
@@ -136,6 +145,7 @@ export default {
136145
hasOrganizer() {
137146
return this.calendarObjectInstance.organizer !== null
138147
},
148+
139149
organizerDisplayName() {
140150
return organizerDisplayName(this.calendarObjectInstance.organizer)
141151
},

src/mixins/EditorMixin.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,18 @@ export default {
214214

215215
return calendar.readOnly
216216
},
217+
isSharedWithMe() {
218+
if (!this.calendarObject) {
219+
return true
220+
}
221+
222+
const calendar = this.$store.getters.getCalendarById(this.calendarObject.calendarId)
223+
if (!calendar) {
224+
return true
225+
}
226+
227+
return calendar.isSharedWithMe
228+
},
217229
/**
218230
* Returns whether the user is an attendee of the event
219231
*

src/views/EditSidebar.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@
246246
<div class="app-sidebar-tab__content">
247247
<InviteesList v-if="!isLoading"
248248
:calendar-object-instance="calendarObjectInstance"
249-
:is-read-only="isReadOnly" />
249+
:is-read-only="isReadOnly"
250+
:is-shared-with-me="isSharedWithMe" />
250251
</div>
251252
<SaveButtons v-if="showSaveButtons"
252253
class="app-sidebar-tab__buttons"

0 commit comments

Comments
 (0)