Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-10-14 17:18:40 +0300
committerJoas Schilling <coding@schilljs.com>2020-10-30 12:38:07 +0300
commitc4a16e6b4da3b8dd80a72387c94cef2cd1fc0758 (patch)
tree7a9db92ff159adcb08d1d565d57ecec5903e9d5c /src
parent2ae99269f491c92a638e7bbad592d1913c1227ef (diff)
Add UI option to enable SIP
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src')
-rw-r--r--src/components/TopBar/TopBar.vue21
-rw-r--r--src/constants.js4
-rw-r--r--src/services/conversationsService.js12
-rw-r--r--src/store/conversationsStore.js14
4 files changed, 51 insertions, 0 deletions
diff --git a/src/components/TopBar/TopBar.vue b/src/components/TopBar/TopBar.vue
index 14499f8a3..f8c702fa1 100644
--- a/src/components/TopBar/TopBar.vue
+++ b/src/components/TopBar/TopBar.vue
@@ -139,6 +139,11 @@
@change="setLobbyTimer">
{{ t('spreed', 'Start time (optional)') }}
</ActionInput>
+ <ActionCheckbox
+ :checked="hasSIPEnabled"
+ @change="toggleSIPEnabled">
+ {{ t('spreed', 'Enable SIP dial-in') }}
+ </ActionCheckbox>
</template>
<template
v-if="showModerationOptions && canFullModerate && isInCall">
@@ -359,6 +364,9 @@ export default {
confirm: true,
}
},
+ hasSIPEnabled() {
+ return this.conversation.sipEnabled === WEBINAR.SIP.ENABLED
+ },
isGrid() {
return this.$store.getters.isGrid
},
@@ -450,6 +458,19 @@ export default {
})
},
+ async toggleSIPEnabled(checked) {
+ try {
+ await this.$store.dispatch('setSIPEnabled', {
+ token: this.token,
+ state: checked ? WEBINAR.SIP.ENABLED : WEBINAR.SIP.DISABLED,
+ })
+ } catch (e) {
+ // TODO check "precondition failed"
+ // TODO showError()
+ console.error(e)
+ }
+ },
+
async setLobbyTimer(date) {
this.lobbyTimerLoading = true
diff --git a/src/constants.js b/src/constants.js
index f967d5a15..0c5abe7d4 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -68,6 +68,10 @@ export const WEBINAR = {
NONE: 0,
NON_MODERATORS: 1,
},
+ SIP: {
+ DISABLED: 0,
+ ENABLED: 1,
+ },
}
export const SHARE = {
TYPE: {
diff --git a/src/services/conversationsService.js b/src/services/conversationsService.js
index 0aa97ed73..534799571 100644
--- a/src/services/conversationsService.js
+++ b/src/services/conversationsService.js
@@ -280,6 +280,17 @@ const makePrivate = async function(token) {
}
/**
+ * Change the SIP enabled
+ * @param {string} token The token of the conversation to be modified
+ * @param {int} newState The new SIP state to set
+ */
+const setSIPEnabled = async function(token, newState) {
+ return axios.put(generateOcsUrl('apps/spreed/api/v2', 2) + `room/${token}/webinar/sip`, {
+ state: newState,
+ })
+}
+
+/**
* Change the lobby state
* @param {string} token The token of the conversation to be modified
* @param {int} newState The new lobby state to set
@@ -327,6 +338,7 @@ export {
setNotificationLevel,
makePublic,
makePrivate,
+ setSIPEnabled,
changeLobbyState,
changeReadOnlyState,
setConversationPassword,
diff --git a/src/store/conversationsStore.js b/src/store/conversationsStore.js
index 886d13bcf..d47dfd729 100644
--- a/src/store/conversationsStore.js
+++ b/src/store/conversationsStore.js
@@ -23,6 +23,7 @@ import Vue from 'vue'
import {
makePublic,
makePrivate,
+ setSIPEnabled,
changeLobbyState,
changeReadOnlyState,
addToFavorites,
@@ -232,6 +233,19 @@ const actions = {
commit('addConversation', conversation)
},
+ async setSIPEnabled({ commit, getters }, { token, state }) {
+ const conversation = Object.assign({}, getters.conversations[token])
+ if (!conversation) {
+ return
+ }
+
+ // The backend requires the state and timestamp to be set together.
+ await setSIPEnabled(token, state)
+ conversation.sipEnabled = state
+
+ commit('addConversation', conversation)
+ },
+
async markConversationRead({ commit, getters }, token) {
const conversation = Object.assign({}, getters.conversations[token])
if (!conversation) {