Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(meetings): selectively invite users from lobby #11395

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/MessagesList/MessagesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export default {
},

chatIdentifier() {
return this.token + ':' + this.isParticipant + ':' + this.isInLobby + ':' + this.viewId
return this.token + ':' + this.isParticipant + ':' + this.viewId
},
},

Expand Down
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="!isSelf && isLobbyEnabled && !canSkipLobby" class="participant-row__guest-indicator">({{ t('spreed', 'in the lobby') }})</span>
</div>

<!-- Second line: participant status message if applicable -->
Expand Down Expand Up @@ -123,7 +124,8 @@
<NcActions v-if="(canBeModerated || canSendCallNotification) && !isSearched"
:container="container"
:aria-label="participantSettingsAriaLabel"
force-menu
:inline="showToggleLobbyAction ? 1 : 0"
:force-menu="!showToggleLobbyAction"
placement="bottom-end"
class="participant-row__actions">
<template #icon>
Expand All @@ -144,6 +146,26 @@
</template>
{{ attendeePin }}
</NcActionText>
<!-- Grant or revoke lobby permissions (inline button) -->
<template v-if="showToggleLobbyAction">
<NcActionButton v-if="canSkipLobby"
close-after-click
@click="setLobbyPermission(false)">
<template #icon>
<AccountMinusIcon :size="20" />
</template>
{{ t('spreed', 'Move back to lobby') }}
</NcActionButton>
<NcActionButton v-else
close-after-click
@click="setLobbyPermission(true)">
<template #icon>
<AccountPlusIcon :size="20" />
</template>
{{ t('spreed', 'Move to conversation') }}
</NcActionButton>
</template>
<!-- Grant or revoke moderator permissions -->
<NcActionButton v-if="canBeDemoted"
close-after-click
@click="demoteFromModerator">
Expand Down Expand Up @@ -292,6 +314,8 @@
import isEqual from 'lodash/isEqual.js'

import Account from 'vue-material-design-icons/Account.vue'
import AccountMinusIcon from 'vue-material-design-icons/AccountMinus.vue'
import AccountPlusIcon from 'vue-material-design-icons/AccountPlus.vue'
import Bell from 'vue-material-design-icons/Bell.vue'
import ContentCopy from 'vue-material-design-icons/ContentCopy.vue'
import Crown from 'vue-material-design-icons/Crown.vue'
Expand Down Expand Up @@ -327,7 +351,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 All @@ -354,6 +378,8 @@ export default {
ParticipantPermissionsEditor,
// Icons
Account,
AccountMinusIcon,
AccountPlusIcon,
Bell,
ContentCopy,
Crown,
Expand Down Expand Up @@ -763,6 +789,18 @@ export default {
|| this.participant.actorType === ATTENDEE.ACTOR_TYPE.EMAILS)
},

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

canSkipLobby() {
return this.isModerator || (this.participant.permissions & PARTICIPANT.PERMISSIONS.LOBBY_IGNORE) !== 0
},

showToggleLobbyAction() {
return this.canBeModerated && !this.isModerator && this.isLobbyEnabled
},

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

async setLobbyPermission(value) {
try {
await this.$store.dispatch('setPermissions', {
token: this.token,
attendeeId: this.attendeeId,
method: value ? 'add' : 'remove',
permissions: PARTICIPANT.PERMISSIONS.LOBBY_IGNORE,
})
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
20 changes: 20 additions & 0 deletions src/components/RightSidebar/Participants/ParticipantsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ export default {
conversation() {
return this.$store.getters.conversation(this.token) || this.$store.getters.dummyConversation
},
userId() {
return this.$store.getters.getUserId()
},
canAddPhones() {
return canModerateSipDialOut && this.conversation.canEnableSIP
},
Expand All @@ -203,18 +206,35 @@ export default {

beforeMount() {
EventBus.$on('route-change', this.abortSearch)
EventBus.$on('signaling-users-changed', this.updateUsers)
Antreesy marked this conversation as resolved.
Show resolved Hide resolved
subscribe('user_status:status.updated', this.updateUserStatus)
},

beforeDestroy() {
EventBus.$off('route-change', this.abortSearch)
EventBus.$off('signaling-users-changed', this.updateUsers)
unsubscribe('user_status:status.updated', this.updateUserStatus)

this.cancelSearchPossibleConversations()
this.cancelSearchPossibleConversations = null
},

methods: {
async updateUsers(usersList) {
const currentUser = usersList.flat().find(user => user.userId === this.userId)
const currentParticipant = this.participants.find(user => user.userId === this.userId)
if (!currentUser) {
return
}
// refresh conversation, if current user permissions have been changed
if (currentUser.participantPermissions !== this.conversation.permissions) {
await this.$store.dispatch('fetchConversation', { token: this.token })
}
if (currentUser.participantPermissions !== currentParticipant?.permissions) {
await this.cancelableGetParticipants()
}
},

handleClose() {
this.$store.dispatch('hideSidebar')
},
Expand Down
5 changes: 3 additions & 2 deletions src/services/participantsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,16 @@ const removeAllPermissionsFromParticipant = async (token, attendeeId) => {
*
* @param {string} token conversation token
* @param {number} attendeeId attendee id to target
* @param {'set'|'add'|'remove'} method permissions update method
* @param {number} permission the type of permission to be granted. Valid values are
* any sums of 'DEFAULT', 'CUSTOM', 'CALL_START', 'CALL_JOIN', 'LOBBY_IGNORE',
* 'PUBLISH_AUDIO', 'PUBLISH_VIDEO', 'PUBLISH_SCREEN'.
*/
const setPermissions = async (token, attendeeId, permission) => {
const setPermissions = async (token, attendeeId, method = 'set', permission) => {
await axios.put(generateOcsUrl('apps/spreed/api/v4/room/{token}/attendees/permissions', { token }),
{
attendeeId,
method: 'set',
method,
permissions: permission,
})
}
Expand Down
5 changes: 3 additions & 2 deletions src/store/participantsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -991,10 +991,11 @@ const actions = {
* @param {object} root0 - the arguments object.
* @param {string} root0.token - the conversation token.
* @param {string} root0.attendeeId - the participant-s attendeeId.
* @param {'set'|'add'|'remove'} [root0.method] permissions update method
* @param {number} root0.permissions - bitwise combination of the permissions.
*/
async setPermissions(context, { token, attendeeId, permissions }) {
await setPermissions(token, attendeeId, permissions)
async setPermissions(context, { token, attendeeId, method, permissions }) {
await setPermissions(token, attendeeId, method, permissions)
const updatedData = {
permissions,
attendeePermissions: permissions,
Expand Down
Loading