diff --git a/src/api/pbx-groups.js b/src/api/pbx-groups.js index 28304178..643fbab6 100644 --- a/src/api/pbx-groups.js +++ b/src/api/pbx-groups.js @@ -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) { diff --git a/src/api/pbx-seats.js b/src/api/pbx-seats.js index be0a264a..613eb5af 100644 --- a/src/api/pbx-seats.js +++ b/src/api/pbx-seats.js @@ -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 diff --git a/src/i18n/de.json b/src/i18n/de.json index e079b7d0..d2ffd8a9 100644 --- a/src/i18n/de.json +++ b/src/i18n/de.json @@ -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." -} \ No newline at end of file +} diff --git a/src/i18n/en.json b/src/i18n/en.json index 356dbdc3..da489bb5 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -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" -} \ No newline at end of file +} diff --git a/src/i18n/es.json b/src/i18n/es.json index 827ce002..0aa235f7 100644 --- a/src/i18n/es.json +++ b/src/i18n/es.json @@ -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" -} \ No newline at end of file +} diff --git a/src/i18n/fr.json b/src/i18n/fr.json index 8136b057..8e06d3a3 100644 --- a/src/i18n/fr.json +++ b/src/i18n/fr.json @@ -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" -} \ No newline at end of file +} diff --git a/src/i18n/it.json b/src/i18n/it.json index 5311f623..96e5c2bc 100644 --- a/src/i18n/it.json +++ b/src/i18n/it.json @@ -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" -} \ No newline at end of file +} diff --git a/src/pages/CscPagePbxGroupDetails.vue b/src/pages/CscPagePbxGroupDetails.vue index db6242eb..744a5d84 100644 --- a/src/pages/CscPagePbxGroupDetails.vue +++ b/src/pages/CscPagePbxGroupDetails.vue @@ -237,6 +237,56 @@ :disable="isLoading" @click="jumpToCallQueueInternal" /> + + + + + + 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) { diff --git a/src/pages/CscPagePbxSeatDetails.vue b/src/pages/CscPagePbxSeatDetails.vue index 84e04781..eab0958a 100644 --- a/src/pages/CscPagePbxSeatDetails.vue +++ b/src/pages/CscPagePbxSeatDetails.vue @@ -279,6 +279,56 @@ :disable="isLoading" @click="goToCallQueue" /> + + + + + + 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({ diff --git a/src/store/pbx-groups.js b/src/store/pbx-groups.js index c14c47f0..3a14a9fd 100644 --- a/src/store/pbx-groups.js +++ b/src/store/pbx-groups.js @@ -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, diff --git a/src/store/pbx-seats.js b/src/store/pbx-seats.js index 851a13e5..ee0b62b0 100644 --- a/src/store/pbx-seats.js +++ b/src/store/pbx-seats.js @@ -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 }) } } }