Files
f7_talk/src/components/ConversationSettings/SipSettings.vue
T
glb_adm 01acfa3b40
Type checking / changes (push) Has been cancelled
Type checking / test (push) Has been cancelled
Type checking / typescript-summary (push) Has been cancelled
Node tests / changes (push) Has been cancelled
Node tests / test (push) Has been cancelled
Node tests / test-summary (push) Has been cancelled
UPSTREAM BASELINE: nextcloud/spreed v22.0.12 (без изменений)
Источник: https://github.com/nextcloud/spreed/archive/refs/tags/v22.0.12.tar.gz
С этого коммита ветка официального Nextcloud Talk отрезана (решение владельца 2026-07-06).
Все дальнейшие изменения — только наши; версии релизов: 22.0.12-f7.N.
2026-07-06 14:07:50 +00:00

110 lines
2.9 KiB
Vue

<!--
- SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<div class="app-settings-subsection">
<h4 class="app-settings-section__subtitle">
{{ t('spreed', 'Phone and SIP dial-in') }}
</h4>
<div>
<NcCheckboxRadioSwitch
:modelValue="hasSIPEnabled"
type="switch"
aria-describedby="sip_settings_hint"
:disabled="isSipLoading"
@update:modelValue="toggleSetting('enable')">
{{ t('spreed', 'Enable phone and SIP dial-in') }}
</NcCheckboxRadioSwitch>
</div>
<div v-if="hasSIPEnabled">
<NcCheckboxRadioSwitch
:modelValue="noPinRequired"
type="switch"
:disabled="isSipLoading || !hasSIPEnabled"
@update:modelValue="toggleSetting('nopin')">
{{ t('spreed', 'Allow to dial-in without a PIN') }}
</NcCheckboxRadioSwitch>
</div>
</div>
</template>
<script>
import { showError, showSuccess } from '@nextcloud/dialogs'
import { t } from '@nextcloud/l10n'
import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch'
import { useGetToken } from '../../composables/useGetToken.ts'
import { WEBINAR } from '../../constants.ts'
export default {
name: 'SipSettings',
components: {
NcCheckboxRadioSwitch,
},
setup() {
return {
token: useGetToken(),
}
},
data() {
return {
isSipLoading: false,
}
},
computed: {
conversation() {
return this.$store.getters.conversation(this.token) || this.$store.getters.dummyConversation
},
hasSIPEnabled() {
return this.conversation.sipEnabled !== WEBINAR.SIP.DISABLED
},
noPinRequired() {
return this.conversation.sipEnabled === WEBINAR.SIP.ENABLED_NO_PIN
},
},
methods: {
t,
async toggleSetting(setting) {
let state = WEBINAR.SIP.DISABLED
if (setting === 'enable') {
state = this.conversation.sipEnabled === WEBINAR.SIP.DISABLED ? WEBINAR.SIP.ENABLED : WEBINAR.SIP.DISABLED
} else if (setting === 'nopin') {
state = this.conversation.sipEnabled === WEBINAR.SIP.ENABLED ? WEBINAR.SIP.ENABLED_NO_PIN : WEBINAR.SIP.ENABLED
}
try {
await this.$store.dispatch('setSIPEnabled', {
token: this.token,
state,
})
if (this.conversation.sipEnabled === WEBINAR.SIP.ENABLED_NO_PIN) {
showSuccess(t('spreed', 'SIP dial-in is now possible without PIN requirement'))
} else if (this.conversation.sipEnabled === WEBINAR.SIP.ENABLED) {
showSuccess(t('spreed', 'SIP dial-in is now enabled'))
} else {
showSuccess(t('spreed', 'SIP dial-in is now disabled'))
}
} catch (e) {
// TODO check "precondition failed"
if (!this.conversation.sipEnabled) {
console.error('Error occurred when enabling SIP dial-in', e)
showError(t('spreed', 'Error occurred when enabling SIP dial-in'))
} else {
console.error('Error occurred when disabling SIP dial-in', e)
showError(t('spreed', 'Error occurred when disabling SIP dial-in'))
}
}
},
},
}
</script>