diff --git a/src/components/RightSidebar/Participants/Participant.spec.js b/src/components/RightSidebar/Participants/Participant.spec.js index c89f053179e..7e866c05d58 100644 --- a/src/components/RightSidebar/Participants/Participant.spec.js +++ b/src/components/RightSidebar/Participants/Participant.spec.js @@ -227,39 +227,43 @@ describe('Participant.vue', () => { /** * Check which status is currently rendered * @param {object} participant participant object - * @param {string|null} status status which expected to be rendered + * @param {string} [status] status which expected to be rendered */ async function checkUserSubnameRendered(participant, status) { const wrapper = mountParticipant(participant) await flushPromises() + const userSubname = wrapper.find('.participant__status') if (status) { - expect(wrapper.find('.participant__status').exists()).toBeTruthy() - expect(wrapper.find('.participant__status').text()).toBe(status) + expect(userSubname.exists()).toBeTruthy() + expect(userSubname.text()).toBe(status) } else { - expect(wrapper.find('.participant__status').exists()).toBeFalsy() + expect(userSubname.exists()).toBeFalsy() } } - test('renders user status', async () => { - await checkUserSubnameRendered(participant, '🌧️ rainy') - }) - - test('does not render user status when not set', async () => { - participant.statusIcon = '' - participant.statusMessage = '' - await checkUserSubnameRendered(participant, null) - }) + const testCases = [ + ['online', '', '', undefined], + ['online', '🌧️', 'Rainy', '🌧️ Rainy'], + ['dnd', '🌧️', 'Rainy', '🌧️ Rainy'], + ['dnd', '🌧️', '', '🌧️ Do not disturb'], + ['away', '🌧️', '', '🌧️ Away'], + ] - test('renders dnd status', async () => { - participant.statusMessage = '' - participant.status = 'dnd' - await checkUserSubnameRendered(participant, '🌧️ Do not disturb') - }) + it.each(testCases)('renders status for participant \'%s\', \'%s\', \'%s\' - \'%s\'', + (status, statusIcon, statusMessage, result) => { + checkUserSubnameRendered({ + ...participant, + status, + statusIcon, + statusMessage, + }, result) + }) - test('renders away status', async () => { - participant.statusMessage = '' - participant.status = 'away' - await checkUserSubnameRendered(participant, '🌧️ Away') + it('renders e-mail as status for e-mail guest', async () => { + participant.actorType = ATTENDEE.ACTOR_TYPE.EMAILS + participant.participantType = PARTICIPANT.TYPE.GUEST + participant.invitedActorId = 'test@mail.com' + await checkUserSubnameRendered(participant, 'test@mail.com') }) }) diff --git a/src/components/RightSidebar/Participants/Participant.vue b/src/components/RightSidebar/Participants/Participant.vue index b1ae97a57b2..9dd5e287727 100644 --- a/src/components/RightSidebar/Participants/Participant.vue +++ b/src/components/RightSidebar/Participants/Participant.vue @@ -512,6 +512,10 @@ export default { : '💬 ' + t('spreed', '{time} talking time', { time: formattedTime(this.timeSpeaking, true) }) } + if (this.isEmailActor && this.participant?.invitedActorId) { + return this.participant.invitedActorId + } + return getStatusMessage(this.participant) }, @@ -820,9 +824,9 @@ export default { token: this.token, attendeeId: this.attendeeId, }) - showSuccess(t('spreed', 'Invitation was sent to {actorId}', { actorId: this.participant.actorId })) + 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.actorId })) + showError(t('spreed', 'Could not send invitation to {actorId}', { actorId: this.participant.invitedActorId })) } },