Skip to content

Commit

Permalink
fix: show e-mail in subline of e-mail guests for moderators
Browse files Browse the repository at this point in the history
- show e-mail in toast when resend invitation
- refactor tests

Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Oct 25, 2024
1 parent b4cefea commit 094eebb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
48 changes: 26 additions & 22 deletions src/components/RightSidebar/Participants/Participant.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '[email protected]'
await checkUserSubnameRendered(participant, '[email protected]')
})
})

Expand Down
8 changes: 6 additions & 2 deletions src/components/RightSidebar/Participants/Participant.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand Down Expand Up @@ -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 }))
}
},
Expand Down

0 comments on commit 094eebb

Please sign in to comment.