diff --git a/src/components/ConversationSettings/LinkShareSettings.vue b/src/components/ConversationSettings/LinkShareSettings.vue index f2e5c2296188..e64dd30a7feb 100644 --- a/src/components/ConversationSettings/LinkShareSettings.vue +++ b/src/components/ConversationSettings/LinkShareSettings.vue @@ -214,12 +214,7 @@ export default { async handleResendInvitations() { this.isSendingInvitations = true - try { - await this.$store.dispatch('resendInvitations', { token: this.token }) - showSuccess(t('spreed', 'Invitations sent')) - } catch (e) { - showError(t('spreed', 'Error occurred when sending invitations')) - } + await this.$store.dispatch('resendInvitations', { token: this.token }) this.isSendingInvitations = false }, }, diff --git a/src/components/RightSidebar/Participants/Participant.spec.js b/src/components/RightSidebar/Participants/Participant.spec.js index 7e866c05d58e..6802f2ef45cd 100644 --- a/src/components/RightSidebar/Participants/Participant.spec.js +++ b/src/components/RightSidebar/Participants/Participant.spec.js @@ -526,6 +526,7 @@ describe('Participant.vue', () => { test('allows moderators to resend invitations for email participants', async () => { conversation.participantType = PARTICIPANT.TYPE.MODERATOR participant.actorType = ATTENDEE.ACTOR_TYPE.EMAILS + participant.invitedActorId = 'alice@mail.com' const wrapper = mountParticipant(participant) const actionButton = findNcActionButton(wrapper, 'Resend invitation') expect(actionButton.exists()).toBe(true) @@ -535,6 +536,7 @@ describe('Participant.vue', () => { expect(resendInvitationsAction).toHaveBeenCalledWith(expect.anything(), { token: 'current-token', attendeeId: 'alice-attendee-id', + actorId: 'alice@mail.com', }) }) diff --git a/src/components/RightSidebar/Participants/Participant.vue b/src/components/RightSidebar/Participants/Participant.vue index 9dd5e287727d..3dd10c184895 100644 --- a/src/components/RightSidebar/Participants/Participant.vue +++ b/src/components/RightSidebar/Participants/Participant.vue @@ -819,15 +819,11 @@ export default { }, async resendInvitation() { - try { - await this.$store.dispatch('resendInvitations', { - token: this.token, - attendeeId: this.attendeeId, - }) - showSuccess(t('spreed', 'Invitation was sent to {actorId}', { actorId: this.participant.invitedActorId })) - } catch (error) { - showError(t('spreed', 'Could not send invitation to {actorId}', { actorId: this.participant.invitedActorId })) - } + await this.$store.dispatch('resendInvitations', { + token: this.token, + attendeeId: this.attendeeId, + actorId: this.participant.invitedActorId ?? this.participant.actorId, + }) }, async sendCallNotification() { diff --git a/src/components/RightSidebar/Participants/ParticipantsTab.vue b/src/components/RightSidebar/Participants/ParticipantsTab.vue index 1f14d9daacca..a32847ab68fe 100644 --- a/src/components/RightSidebar/Participants/ParticipantsTab.vue +++ b/src/components/RightSidebar/Participants/ParticipantsTab.vue @@ -65,7 +65,7 @@ import { ref, toRefs } from 'vue' import IconInformationOutline from 'vue-material-design-icons/InformationOutline.vue' -import { showError } from '@nextcloud/dialogs' +import { showError, showSuccess } from '@nextcloud/dialogs' import { subscribe, unsubscribe } from '@nextcloud/event-bus' import { t } from '@nextcloud/l10n' @@ -311,6 +311,9 @@ export default { async addParticipants(item) { try { await addParticipant(this.token, item.id, item.source) + if (item.source === ATTENDEE.ACTOR_TYPE.EMAILS) { + showSuccess(t('spreed', 'Invitation was sent to {actorId}', { actorId: item.id })) + } this.abortSearch() this.cancelableGetParticipants() } catch (exception) { diff --git a/src/services/participantsService.js b/src/services/participantsService.js index 1cc6be514e18..cc44122cde34 100644 --- a/src/services/participantsService.js +++ b/src/services/participantsService.js @@ -158,9 +158,9 @@ const setGuestUserName = async (token, userName) => { * If no userId is set, send to all applicable participants. * * @param {string} token conversation token - * @param {number} attendeeId attendee id to target, or null for all + * @param {number|null} [attendeeId] attendee id to target, or null for all */ -const resendInvitations = async (token, { attendeeId = null }) => { +const resendInvitations = async (token, attendeeId = null) => { await axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants/resend-invitations', { token }), { attendeeId, }) diff --git a/src/store/participantsStore.js b/src/store/participantsStore.js index 09fc6f91f93b..01cc3f7922f8 100644 --- a/src/store/participantsStore.js +++ b/src/store/participantsStore.js @@ -883,10 +883,26 @@ const actions = { * @param {object} _ - unused. * @param {object} data - the wrapping object. * @param {string} data.token - conversation token. - * @param {number} data.attendeeId - attendee id to target, or null for all. + * @param {number} [data.attendeeId] - attendee id to target, or null for all. + * @param {number} [data.actorId] - attendee id to target, or null for all. */ - async resendInvitations(_, { token, attendeeId }) { - await resendInvitations(token, { attendeeId }) + async resendInvitations(_, { token, attendeeId, actorId }) { + if (attendeeId) { + try { + await resendInvitations(token, attendeeId) + showSuccess(t('spreed', 'Invitation was sent to {actorId}', { actorId })) + } catch (error) { + showError(t('spreed', 'Could not send invitation to {actorId}', { actorId })) + } + } else { + try { + await resendInvitations(token) + showSuccess(t('spreed', 'Invitations sent')) + } catch (e) { + showError(t('spreed', 'Error occurred when sending invitations')) + } + } + }, /** diff --git a/src/store/participantsStore.spec.js b/src/store/participantsStore.spec.js index 70dc8baac555..f0cd9765c782 100644 --- a/src/store/participantsStore.spec.js +++ b/src/store/participantsStore.spec.js @@ -693,7 +693,7 @@ describe('participantsStore', () => { attendeeId: 1, }) - expect(resendInvitations).toHaveBeenCalledWith(TOKEN, { attendeeId: 1 }) + expect(resendInvitations).toHaveBeenCalledWith(TOKEN, 1) }) describe('joining conversation', () => {