Skip to content

Commit

Permalink
feat(lobby): allow moderators to toggle lobby permission for specific…
Browse files Browse the repository at this point in the history
… user

Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Jan 17, 2024
1 parent eee376e commit 406767a
Showing 1 changed file with 48 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<span v-if="showModeratorLabel" class="participant-row__moderator-indicator">({{ t('spreed', 'moderator') }})</span>
<span v-if="isBridgeBotUser" class="participant-row__moderator-indicator">({{ t('spreed', 'bot') }})</span>
<span v-if="isGuest" class="participant-row__guest-indicator">({{ t('spreed', 'guest') }})</span>
<span v-if="isParticipantInLobby" class="participant-row__guest-indicator">({{ t('spreed', 'in the lobby') }})</span>
</div>

<!-- Second line: participant status message if applicable -->
Expand Down Expand Up @@ -160,6 +161,24 @@
</template>
{{ t('spreed', 'Promote to moderator') }}
</NcActionButton>
<template v-if="canBeModerated && hasLobbyEnabled">
<NcActionButton v-if="isParticipantInLobby"
close-after-click
@click="setLobbyPermission(true)">
<template #icon>
<RoomService :size="20" />
</template>
{{ t('spreed', 'Invite from lobby') }}
</NcActionButton>
<NcActionButton v-else
close-after-click
@click="setLobbyPermission(false)">
<template #icon>
<RoomService :size="20" />
</template>
{{ t('spreed', 'Return back to lobby') }}
</NcActionButton>
</template>
<NcActionButton v-if="canBeModerated && isEmailActor"
close-after-click
@click="resendInvitation">
Expand Down Expand Up @@ -309,6 +328,7 @@ import Phone from 'vue-material-design-icons/Phone.vue'
import PhoneHangup from 'vue-material-design-icons/PhoneHangup.vue'
import PhoneInTalk from 'vue-material-design-icons/PhoneInTalk.vue'
import PhonePaused from 'vue-material-design-icons/PhonePaused.vue'
import RoomService from 'vue-material-design-icons/RoomService.vue'
import Tune from 'vue-material-design-icons/Tune.vue'
import VideoIcon from 'vue-material-design-icons/Video.vue'

Expand All @@ -327,7 +347,7 @@ import AvatarWrapper from '../../../../AvatarWrapper/AvatarWrapper.vue'
import DialpadPanel from '../../../../DialpadPanel.vue'

import { useIsInCall } from '../../../../../composables/useIsInCall.js'
import { CONVERSATION, PARTICIPANT, ATTENDEE } from '../../../../../constants.js'
import { CONVERSATION, PARTICIPANT, ATTENDEE, WEBINAR } from '../../../../../constants.js'
import {
callSIPDialOut,
callSIPHangupPhone,
Expand Down Expand Up @@ -371,6 +391,7 @@ export default {
PhoneInTalk,
PhoneHangup,
PhonePaused,
RoomService,
Tune,
VideoIcon,
},
Expand Down Expand Up @@ -763,6 +784,15 @@ export default {
|| this.participant.actorType === ATTENDEE.ACTOR_TYPE.EMAILS)
},

hasLobbyEnabled() {
return this.conversation.lobbyState === WEBINAR.LOBBY.NON_MODERATORS
},

isParticipantInLobby() {
return this.hasLobbyEnabled && !this.isOffline
&& (this.attendeePermissions & PARTICIPANT.PERMISSIONS.LOBBY_IGNORE) === 0
},

preloadedUserStatus() {
if (Object.prototype.hasOwnProperty.call(this.participant, 'statusMessage')) {
// We preloaded the status when via participants API
Expand Down Expand Up @@ -935,6 +965,23 @@ export default {
}
},

async setLobbyPermission(value) {
// Bitwise add or subtract lobby permission for a participant
const newPermissions = value
? this.participant.permissions | PARTICIPANT.PERMISSIONS.LOBBY_IGNORE
: this.participant.permissions & (~PARTICIPANT.PERMISSIONS.LOBBY_IGNORE)
try {
await this.$store.dispatch('setPermissions', { token: this.token, attendeeId: this.attendeeId, permissions: newPermissions })
if (value) {
showSuccess(t('spreed', 'Permissions granted to {displayName}', { displayName: this.computedName }))
} else {
showSuccess(t('spreed', 'Permissions removed for {displayName}', { displayName: this.computedName }))
}
} catch (error) {
showError(t('spreed', 'Could not modify permissions for {displayName}', { displayName: this.computedName }))
}
},

computeElapsedTime() {
if (!this.participantSpeakingInformation) {
return null
Expand Down

0 comments on commit 406767a

Please sign in to comment.