MT#64806 Adds conference preferences for PBX seats/groups

* Created two PBX configuration fields for both
    seat and group preferences
    * Admin users can now specify the maximum number
    of conference participants as well as the conference
    pin if they so desire
  * Fixes the PATCH flow so that it follows the following structure
    1. create new: PATCH add
    2. amend entry: PATCH replace
    3. remove entry: PATCH remove
  * We no longer use PATCH replace with an empty payload
    to remove an entry
  * Added label translations

Change-Id: I3e349c0d0cc896c6dcbb2ada0a9588e3b96c945a
mr26.0
Giancarlo Errigo Mattos 5 months ago committed by Debora Crescenzo
parent 58e7a88272
commit d798bae6ad

@ -9,12 +9,15 @@ import {
} from 'src/api/pbx-config'
import { getSeatsOnly } from 'src/api/pbx-seats'
import {
addPreference,
createSubscriber,
deleteSubscriber,
generateGeneralPassword,
getFullSubscribers,
getSubscriberAndPreferences,
getSubscribers,
removePreference,
replacePreference,
setDisplayName,
setPbxExtension, setPbxGroupMemberIds,
setPbxHuntCancelMode,
@ -321,6 +324,18 @@ export function setGroupAnnouncementCallSetup (groupId, announcementCallSetup) {
return setPreferenceAnnouncementCallSetup(groupId, announcementCallSetup)
}
export function setGroupPreferenceField (groupId, field, value) {
return replacePreference(groupId, field, value)
}
export function addGroupPreferenceField (groupId, field, value) {
return addPreference(groupId, field, value)
}
export function removeGroupPreferenceField (groupId, field) {
return removePreference(groupId, field)
}
// This mirrors the logic we use in ngcp-admin to handle the pbx groups creation
// If you change the logic below make sure you make the same changes in ngcp-admin too
function createUsername (name) {

@ -13,6 +13,7 @@ import {
} from 'src/api/pbx-config'
import { getGroupsOnly } from 'src/api/pbx-groups'
import {
addPreference,
createSubscriber,
deleteSubscriber,
generateGeneralPassword,
@ -20,6 +21,8 @@ import {
getPreferences,
getSubscriberAndPreferences,
getSubscribers,
removePreference,
replacePreference,
setDisplayName,
setPbxExtension,
setPbxGroupIds,
@ -383,6 +386,18 @@ export function setSeatCstaController (seatId, cstaController) {
return setPreferenceCstaController(seatId, cstaController)
}
export function setSeatPreferenceField (seatId, field, value) {
return replacePreference(seatId, field, value)
}
export function addSeatPreferenceField (seatId, field, value) {
return addPreference(seatId, field, value)
}
export function removeSeatPreferenceField (seatId, field) {
return removePreference(seatId, field)
}
/**
* @param options
* @param options.seatId

@ -114,6 +114,7 @@
"Close": "Schließen",
"Close filters": "Filter schließen",
"Conference": "Konferenz",
"Conference PIN": "Konferenz-PIN",
"Conference name": "Konferenzname",
"Confirm": "Bestätigen",
"Contact": "Kontakt",
@ -312,6 +313,7 @@
"March": "März",
"Maximum allowed extension is {max}": "Maximal erlaubte Nebenstellenlänge ist {max}",
"Maximum calls in queue": "Maximale Anrufe in Warteschlange",
"Maximum Conference Participants": "Maximale Anzahl der Konferenzteilnehmer",
"May": "Mai",
"Me": "Ich",
"Messages": "Nachrichten",
@ -721,4 +723,4 @@
"{field} must consist of numeric characters only": "{field} darf nur Zahlen enthalten.",
"{field} must consist only of numeric characters or the symbols +, * or #.": "{field} darf nur aus Zahlen oder den Symbolen +, * oder # bestehen.",
"{field} must have at most {maxLength} letters": "{field} darf maximal {maxLength} Buchstaben enthalten."
}
}

@ -114,6 +114,7 @@
"Close": "Close",
"Close filters": "Close filters",
"Conference": "Conference",
"Conference PIN": "Conference PIN",
"Confirm": "Confirm",
"Contact": "Contact",
"Contact your administrator to activate this functionality": "Contact your administrator to activate this functionality",
@ -305,6 +306,7 @@
"March": "March",
"Maximum allowed extension is {max}": "Maximum allowed extension is {max}",
"Maximum calls in queue": "Maximum calls in queue",
"Maximum Conference Participants": "Maximum Conference Participants",
"May": "May",
"Me": "Me",
"Messages": "Messages",
@ -703,4 +705,4 @@
"{field} must consist of numeric characters only": "{field} must consist of numeric characters only",
"{field} must consist only of numeric characters or the symbols +, * or #.": "{field} must consist only of numeric characters or the symbols +, * or #.",
"{field} must have at most {maxLength} letters": "{field} must have at most {maxLength} letters"
}
}

@ -114,6 +114,7 @@
"Close": "Cerrar",
"Close filters": "Cerrar filtros",
"Conference": "Conferencias",
"Conference PIN": "PIN de conferencia",
"Conference name": "Nombre de la conferencia",
"Confirm": "Confirmar",
"Contact": "Contacto",
@ -313,6 +314,7 @@
"March": "Marzo",
"Maximum allowed extension is {max}": "La extensión máxima permitida es {max}",
"Maximum calls in queue": "Máximo de llamadas en cola",
"Maximum Conference Participants": "Máximo de participantes en la conferencia",
"May": "Mayo",
"Me": "Yo",
"Messages": "Mensajes",
@ -724,4 +726,4 @@
"{field} must consist of numeric characters only": "El campo {field} debe constar sólo de caracteres numéricos",
"{field} must consist only of numeric characters or the symbols +, * or #.": "El campo {field} debe consistir únicamente en caracteres numéricos o los símbolos +, * o #.",
"{field} must have at most {maxLength} letters": "El campo {field} debe tener como máximo {maxLength} letras"
}
}

@ -114,6 +114,7 @@
"Close": "Fermer",
"Close filters": "Fermer les filtres",
"Conference": "Conférence",
"Conference PIN": "Code PIN de la conférence",
"Conference name": "Nom de la conférence",
"Confirm": "Confirmer",
"Contact": "Contact",
@ -312,6 +313,7 @@
"March": "Mars",
"Maximum allowed extension is {max}": "L'extension maximale autorisée est de {max}",
"Maximum calls in queue": "Nombre maximum d'appels dans la file d'attente",
"Maximum Conference Participants": "Nombre maximal de participants à la conférence",
"May": "Mai",
"Me": "Moi",
"Messages": "Messages",
@ -720,4 +722,4 @@
"{field} must consist of numeric characters only": "{field} ne peut contenir que des caractères numériques",
"{field} must consist only of numeric characters or the symbols +, * or #.": "Le champ {field} doit contenir uniquement des caractères numériques ou les symboles +, * ou #.",
"{field} must have at most {maxLength} letters": "{field} doit avoir au maximum {maxLength} caractères"
}
}

@ -113,6 +113,7 @@
"Close": "Chiudi",
"Close filters": "Chiudi filtri",
"Conference": "Conferenza",
"Conference PIN": "PIN conferenza",
"Conference name": "Nome conferenza",
"Confirm": "Conferma",
"Contact": "Contatto",
@ -309,6 +310,7 @@
"March": "Marzo",
"Maximum allowed extension is {max}": "L'interno massimo consentito è {max}",
"Maximum calls in queue": "Numero massimo di chiamate in coda",
"Maximum Conference Participants": "Numero massimo di partecipanti alla conferenza",
"May": "Maggio",
"Me": "Me",
"Messages": "Messaggi",
@ -711,4 +713,4 @@
"{field} must consist of numeric characters only": "Il campo {field} deve contenere solo caratteri numerici",
"{field} must consist only of numeric characters or the symbols +, * or #.": "{field} deve contenere solo caratteri numerici o i simboli +, * o #.",
"{field} must have at most {maxLength} letters": "Il campo {field} può contenere al massimo {maxLength} lettere"
}
}

@ -237,6 +237,56 @@
:disable="isLoading"
@click="jumpToCallQueueInternal"
/>
<q-input
v-model="changes.conferenceMaxParticipants"
:label="$t('Maximum Conference Participants')"
:disable="isLoading"
:error="v$.changes.conferenceMaxParticipants.$errors.length > 0"
:error-message="conferenceMaxParticipantsErrorMessage"
@update:model-value="v$.changes.conferenceMaxParticipants.$touch()"
@keyup.enter="save"
@keypress.space.prevent
@keydown.space.prevent
@keyup.space.prevent
>
<template
v-if="hasConferenceMaxParticipantsChanged"
#append
>
<csc-input-button-save
v-if="v$.changes.conferenceMaxParticipants.$errors.length <= 0"
@click.stop="save"
/>
<csc-input-button-reset
@click.stop="resetConferenceMaxParticipants"
/>
</template>
</q-input>
<q-input
v-model="changes.conferencePin"
:label="$t('Conference PIN')"
:disable="isLoading"
:error="v$.changes.conferencePin.$errors.length > 0"
:error-message="conferencePinErrorMessage"
@update:model-value="v$.changes.conferencePin.$touch()"
@keyup.enter="save"
@keypress.space.prevent
@keydown.space.prevent
@keyup.space.prevent
>
<template
v-if="hasConferencePinChanged"
#append
>
<csc-input-button-save
v-if="v$.changes.conferencePin.$errors.length <= 0"
@click.stop="save"
/>
<csc-input-button-reset
@click.stop="resetConferencePin"
/>
</template>
</q-input>
</q-list>
<q-list
v-if="changes"
@ -290,6 +340,7 @@
<script>
import useValidate from '@vuelidate/core'
import { numeric } from '@vuelidate/validators'
import CscPageStickyTabs from 'components/CscPageStickyTabs'
import CscInputButtonReset from 'components/form/CscInputButtonReset'
import CscInputButtonSave from 'components/form/CscInputButtonSave'
@ -387,6 +438,8 @@ export default {
'getHuntCancelModeOptions',
'getAnnouncementCfu',
'getAnnouncementCallSetup',
'getConferenceMaxParticipants',
'getConferencePin',
'isGroupMapByIdEmpty'
]),
...mapGetters('callForwarding', [
@ -425,6 +478,12 @@ export default {
hasSoundSetChanged () {
return this.changes.soundSet !== this.getSoundSetId()
},
hasConferenceMaxParticipantsChanged () {
return this.changes.conferenceMaxParticipants !== this.getConferenceMaxParticipants(this.groupSelected.id)
},
hasConferencePinChanged () {
return this.changes.conferencePin !== this.getConferencePin(this.groupSelected.id)
},
getPrimaryNumber () {
return numberFilter(this.groupSelected.primary_number)
},
@ -435,6 +494,24 @@ export default {
}
return ''
},
conferenceMaxParticipantsErrorMessage () {
const errorsTab = this.v$.changes.conferenceMaxParticipants.$errors
if (errorsTab && errorsTab.length > 0 && errorsTab[0].$validator === 'numeric') {
return this.$t('{field} must consist of numeric characters only', {
field: this.$t('Maximum Conference Participants')
})
}
return ''
},
conferencePinErrorMessage () {
const errorsTab = this.v$.changes.conferencePin.$errors
if (errorsTab && errorsTab.length > 0 && errorsTab[0].$validator === 'numeric') {
return this.$t('{field} must consist of numeric characters only', {
field: this.$t('Conference PIN')
})
}
return ''
},
isLoading () {
return this.isGroupLoading(this.groupSelected.id)
},
@ -488,6 +565,12 @@ export default {
isInRange: function (value) {
return inRange(value, this.getMinAllowedExtension, this.getMaxAllowedExtension)
}
},
conferenceMaxParticipants: {
numeric
},
conferencePin: {
numeric
}
}
},
@ -501,6 +584,8 @@ export default {
'setGroupSeats',
'setGroupNumbers',
'setGroupSoundSet',
'setConferenceMaxParticipants',
'setConferencePin',
'setAnnouncementCallSetup',
'setAnnouncementCfu',
'loadGroupListItems'
@ -528,6 +613,8 @@ export default {
aliasNumbers: this.getAliasNumberIds(),
seats: this.getSeatIds(),
soundSet: this.getSoundSetId(),
conferenceMaxParticipants: this.getConferenceMaxParticipants(this.groupSelected.id),
conferencePin: this.getConferencePin(this.groupSelected.id),
announcementCallSetup: this.getAnnouncementCallSetup(this.groupSelected.id),
announcementCfu: this.getAnnouncementCfu(this.groupSelected.id)
}
@ -574,6 +661,12 @@ export default {
resetSoundSet () {
this.changes.soundSet = this.getSoundSetId()
},
resetConferenceMaxParticipants () {
this.changes.conferenceMaxParticipants = this.getConferenceMaxParticipants(this.groupSelected.id)
},
resetConferencePin () {
this.changes.conferencePin = this.getConferencePin(this.groupSelected.id)
},
jumpToCallQueueInternal () {
this.jumpToCallQueue(this.groupSelected)
},
@ -627,6 +720,18 @@ export default {
soundSetId: this.changes.soundSet
})
}
if (this.hasConferenceMaxParticipantsChanged) {
this.setConferenceMaxParticipants({
groupId: this.groupSelected.id,
conferenceMaxParticipants: this.changes.conferenceMaxParticipants
})
}
if (this.hasConferencePinChanged) {
this.setConferencePin({
groupId: this.groupSelected.id,
conferencePin: this.changes.conferencePin
})
}
},
selectTab (tabName) {
if (this.selectedTab !== tabName) {

@ -279,6 +279,56 @@
:disable="isLoading"
@click="goToCallQueue"
/>
<q-input
v-model="changes.conferenceMaxParticipants"
:label="$t('Maximum Conference Participants')"
:disable="isLoading"
:error="v$.changes.conferenceMaxParticipants.$errors.length > 0"
:error-message="conferenceMaxParticipantsErrorMessage"
@update:model-value="v$.changes.conferenceMaxParticipants.$touch()"
@keyup.enter="save"
@keypress.space.prevent
@keydown.space.prevent
@keyup.space.prevent
>
<template
v-if="hasConferenceMaxParticipantsChanged"
#append
>
<csc-input-button-save
v-if="v$.changes.conferenceMaxParticipants.$errors.length <= 0"
@click.stop="save"
/>
<csc-input-button-reset
@click.stop="resetConferenceMaxParticipants"
/>
</template>
</q-input>
<q-input
v-model="changes.conferencePin"
:label="$t('Conference PIN')"
:disable="isLoading"
:error="v$.changes.conferencePin.$errors.length > 0"
:error-message="conferencePinErrorMessage"
@update:model-value="v$.changes.conferencePin.$touch()"
@keyup.enter="save"
@keypress.space.prevent
@keydown.space.prevent
@keyup.space.prevent
>
<template
v-if="hasConferencePinChanged"
#append
>
<csc-input-button-save
v-if="v$.changes.conferencePin.$errors.length <= 0"
@click.stop="save"
/>
<csc-input-button-reset
@click.stop="resetConferencePin"
/>
</template>
</q-input>
</q-list>
<q-list
v-if="changes"
@ -388,7 +438,11 @@
<script>
import useValidate from '@vuelidate/core'
import { maxLength, required } from '@vuelidate/validators'
import {
maxLength,
numeric,
required
} from '@vuelidate/validators'
import CscChangePasswordDialog from 'components/CscChangePasswordDialog'
import CscPageStickyTabs from 'components/CscPageStickyTabs'
import CscInputButtonReset from 'components/form/CscInputButtonReset'
@ -491,6 +545,8 @@ export default {
'getMusicOnHold',
'getDefaultNcos',
'getDefaultNcosSet',
'getConferenceMaxParticipants',
'getConferencePin',
'getCurrentCli',
'getIntraPbx',
'getClir',
@ -542,6 +598,12 @@ export default {
hasNcosSetChanged () {
return this.changes.ncosSet !== this.getDefaultNcosSet(this.seatSelected.id)
},
hasConferenceMaxParticipantsChanged () {
return this.changes.conferenceMaxParticipants !== this.getConferenceMaxParticipants(this.seatSelected.id)
},
hasConferencePinChanged () {
return this.changes.conferencePin !== this.getConferencePin(this.seatSelected.id)
},
extensionErrorMessage () {
const errorsTab = this.v$.changes.extension.$errors
if (errorsTab && errorsTab.length > 0 && errorsTab[0].$validator === 'isInRange') {
@ -580,6 +642,24 @@ export default {
showClir () {
return this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.clir)
},
conferenceMaxParticipantsErrorMessage () {
const errorsTab = this.v$.changes.conferenceMaxParticipants.$errors
if (errorsTab && errorsTab.length > 0 && errorsTab[0].$validator === 'numeric') {
return this.$t('{field} must consist of numeric characters only', {
field: this.$t('Maximum Conference Participants')
})
}
return ''
},
conferencePinErrorMessage () {
const errorsTab = this.v$.changes.conferencePin.$errors
if (errorsTab && errorsTab.length > 0 && errorsTab[0].$validator === 'numeric') {
return this.$t('{field} must consist of numeric characters only', {
field: this.$t('Conference PIN')
})
}
return ''
},
showClirIntraPbx () {
return this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.clir_intrapbx)
},
@ -698,6 +778,12 @@ export default {
webUsername: {
required,
maxLength: maxLength(64)
},
conferenceMaxParticipants: {
numeric
},
conferencePin: {
numeric
}
}
},
@ -725,7 +811,9 @@ export default {
'setAnnouncementToCallee',
'setIgnoreCfWhenHunting',
'setCstaClient',
'setCstaController'
'setCstaController',
'setConferenceMaxParticipants',
'setConferencePin'
]),
...mapActions('user', [
'getNcosLevelsSubscriber',
@ -802,7 +890,9 @@ export default {
soundSet: this.getSoundSetId(),
cliNumber: this.getCliNumberId(),
ncos: this.getDefaultNcos(this.seatSelected.id),
ncosSet: this.getDefaultNcosSet(this.seatSelected.id)
ncosSet: this.getDefaultNcosSet(this.seatSelected.id),
conferenceMaxParticipants: this.getConferenceMaxParticipants(this.seatSelected.id),
conferencePin: this.getConferencePin(this.seatSelected.id)
}
: null
},
@ -833,6 +923,12 @@ export default {
resetNcosSet () {
this.changes.ncosSet = this.getDefaultNcosSet(this.seatSelected.id)
},
resetConferenceMaxParticipants () {
this.changes.conferenceMaxParticipants = this.getConferenceMaxParticipants(this.seatSelected.id)
},
resetConferencePin () {
this.changes.conferencePin = this.getConferencePin(this.seatSelected.id)
},
save () {
if (this.hasDisplayNameChanged) {
this.setSeatDisplayName({
@ -889,6 +985,18 @@ export default {
ncosSetId: this.changes.ncosSet
})
}
if (this.hasConferenceMaxParticipantsChanged && this.v$.changes.conferenceMaxParticipants.$errors.length <= 0) {
this.setConferenceMaxParticipants({
seatId: this.seatSelected.id,
conferenceMaxParticipants: this.changes.conferenceMaxParticipants
})
}
if (this.hasConferencePinChanged && this.v$.changes.conferencePin.$errors.length <= 0) {
this.setConferencePin({
seatId: this.seatSelected.id,
conferencePin: this.changes.conferencePin
})
}
},
changeClir () {
this.setClir({

@ -1,9 +1,11 @@
import { i18n } from 'boot/i18n'
import _ from 'lodash'
import {
addGroupPreferenceField,
createGroup,
getGroupList,
removeGroup,
removeGroupPreferenceField,
setGroupAnnouncementCallSetup,
setGroupAnnouncementCfu,
setGroupExtension,
@ -12,6 +14,7 @@ import {
setGroupHuntTimeout,
setGroupName,
setGroupNumbers,
setGroupPreferenceField,
setGroupSeats,
setGroupSoundSet
} from 'src/api/pbx-groups'
@ -174,6 +177,20 @@ export default {
const groupPreferences = state.preferenceMapById[id]
return groupPreferences && groupPreferences.play_announce_before_call_setup ? state.preferenceMapById[id].play_announce_before_call_setup : false
}
},
getConferenceMaxParticipants (state) {
return (id) => {
const groupPreferences = state.preferenceMapById[id]
const value = groupPreferences?.conference_max_participants ?? ''
return value === null || value === undefined ? '' : value.toString()
}
},
getConferencePin (state) {
return (id) => {
const groupPreferences = state.preferenceMapById[id]
const value = groupPreferences?.conference_pin ?? ''
return value === null || value === undefined ? '' : value.toString()
}
}
},
mutations: {
@ -440,6 +457,72 @@ export default {
context.commit('groupUpdateFailed', err.message)
})
},
async setConferenceMaxParticipants (context, options) {
context.commit('groupUpdateRequesting', {
groupId: options.groupId,
groupField: i18n.global.t('Maximum Conference Participants')
})
const groupPreferencesList = Object.keys(context.state.preferenceMapById[options.groupId] || {})
const hasConferenceMaxParticipants = groupPreferencesList.includes('conference_max_participants')
const group = context.state.groupMapById[options.groupId]
if (hasConferenceMaxParticipants && options.conferenceMaxParticipants === '') {
await removeGroupPreferenceField(options.groupId, 'conference_max_participants')
const preferences = { ...context.state.preferenceMapById[options.groupId] }
delete preferences.conference_max_participants
return context.commit('groupUpdateSucceeded', { group, preferences })
}
if (hasConferenceMaxParticipants) {
await setGroupPreferenceField(options.groupId, 'conference_max_participants', options.conferenceMaxParticipants)
const preferences = {
...context.state.preferenceMapById[options.groupId],
conference_max_participants: options.conferenceMaxParticipants
}
return context.commit('groupUpdateSucceeded', { group, preferences })
}
await addGroupPreferenceField(options.groupId, 'conference_max_participants', options.conferenceMaxParticipants)
const preferences = {
...context.state.preferenceMapById[options.groupId],
conference_max_participants: options.conferenceMaxParticipants
}
context.commit('groupUpdateSucceeded', { group, preferences })
},
async setConferencePin (context, options) {
context.commit('groupUpdateRequesting', {
groupId: options.groupId,
groupField: i18n.global.t('Conference PIN')
})
const groupPreferencesList = Object.keys(context.state.preferenceMapById[options.groupId] || {})
const hasConferencePin = groupPreferencesList.includes('conference_pin')
const group = context.state.groupMapById[options.groupId]
if (hasConferencePin && options.conferencePin === '') {
await removeGroupPreferenceField(options.groupId, 'conference_pin')
const preferences = { ...context.state.preferenceMapById[options.groupId] }
delete preferences.conference_pin
return context.commit('groupUpdateSucceeded', { group, preferences })
}
if (hasConferencePin) {
await setGroupPreferenceField(options.groupId, 'conference_pin', options.conferencePin)
const preferences = {
...context.state.preferenceMapById[options.groupId],
conference_pin: options.conferencePin
}
return context.commit('groupUpdateSucceeded', { group, preferences })
}
await addGroupPreferenceField(options.groupId, 'conference_pin', options.conferencePin)
const preferences = {
...context.state.preferenceMapById[options.groupId],
conference_pin: options.conferencePin
}
context.commit('groupUpdateSucceeded', { group, preferences })
},
async setAnnouncementCfu (context, options) {
context.commit('groupUpdateRequesting', {
groupId: options.groupId,

@ -5,10 +5,12 @@ import _ from 'lodash'
import {
NcosSet,
NcosSets,
addSeatPreferenceField,
createSeat,
getSeatList,
getSeatPreferences,
removeSeat,
removeSeatPreferenceField,
setNcosLevelSets,
setNcosSet,
setSeatAnnouncementCallSetup,
@ -25,6 +27,7 @@ import {
setSeatIntraPbx,
setSeatMusicOnHold,
setSeatNumbers,
setSeatPreferenceField,
setSeatSIPPassword,
setSeatSoundSet,
setSeatWebPassword,
@ -178,6 +181,20 @@ export default {
return state?.preferenceMapById[id]?.cli || false
}
},
getConferenceMaxParticipants (state) {
return (id) => {
const seatPreferences = state.preferenceMapById[id]
const value = seatPreferences?.conference_max_participants ?? ''
return value === null || value === undefined ? '' : value.toString()
}
},
getConferencePin (state) {
return (id) => {
const seatPreferences = state.preferenceMapById[id]
const value = seatPreferences?.conference_pin ?? ''
return value === null || value === undefined ? '' : value.toString()
}
},
getSeatCreatingName (state) {
return _.get(state, 'seatCreating.name', '')
},
@ -678,6 +695,72 @@ export default {
} catch (err) {
context.commit('seatUpdateFailed', err.message)
}
},
async setConferenceMaxParticipants (context, options) {
context.commit('seatUpdateRequesting', {
seatId: options.seatId,
seatField: i18n.global.t('Maximum Conference Participants')
})
const seatPreferencesList = Object.keys(context.state.preferenceMapById[options.seatId] || {})
const hasConferenceMaxParticipants = seatPreferencesList.includes('conference_max_participants')
const seat = context.state.seatMapById[options.seatId]
if (hasConferenceMaxParticipants && options.conferenceMaxParticipants === '') {
await removeSeatPreferenceField(options.seatId, 'conference_max_participants')
const preferences = { ...context.state.preferenceMapById[options.seatId] }
delete preferences.conference_max_participants
return context.commit('seatUpdateSucceeded', { seat, preferences })
}
if (hasConferenceMaxParticipants) {
await setSeatPreferenceField(options.seatId, 'conference_max_participants', options.conferenceMaxParticipants)
const preferences = {
...context.state.preferenceMapById[options.seatId],
conference_max_participants: options.conferenceMaxParticipants
}
return context.commit('seatUpdateSucceeded', { seat, preferences })
}
await addSeatPreferenceField(options.seatId, 'conference_max_participants', options.conferenceMaxParticipants)
const preferences = {
...context.state.preferenceMapById[options.seatId],
conference_max_participants: options.conferenceMaxParticipants
}
context.commit('seatUpdateSucceeded', { seat, preferences })
},
async setConferencePin (context, options) {
context.commit('seatUpdateRequesting', {
seatId: options.seatId,
seatField: options.conferencePin
})
const seatPreferencesList = Object.keys(context.state.preferenceMapById[options.seatId] || {})
const hasConferencePin = seatPreferencesList.includes('conference_pin')
const seat = context.state.seatMapById[options.seatId]
if (hasConferencePin && options.conferencePin === '') {
await removeSeatPreferenceField(options.seatId, 'conference_pin')
const preferences = { ...context.state.preferenceMapById[options.seatId] }
delete preferences.conference_pin
return context.commit('seatUpdateSucceeded', { seat, preferences })
}
if (hasConferencePin) {
await setSeatPreferenceField(options.seatId, 'conference_pin', options.conferencePin)
const preferences = {
...context.state.preferenceMapById[options.seatId],
conference_pin: options.conferencePin
}
return context.commit('seatUpdateSucceeded', { seat, preferences })
}
await addSeatPreferenceField(options.seatId, 'conference_pin', options.conferencePin)
const preferences = {
...context.state.preferenceMapById[options.seatId],
conference_pin: options.conferencePin
}
return context.commit('seatUpdateSucceeded', { seat, preferences })
}
}
}

Loading…
Cancel
Save