Skip to content
Closed
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
10 changes: 9 additions & 1 deletion src/components/ConversationSettings/LockingSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,28 @@
class="checkbox"
name="moderation_settings_lock_conversation_checkbox"
:checked="isReadOnly"
:disabled="isReadOnlyStateLoading"
:disabled="isReadOnlyStateLoading || isInCall"
@change="toggleReadOnly">
<label for="moderation_settings_lock_conversation_checkbox">{{ t('spreed', 'Lock conversation') }}</label>
<span v-if="isInCall">{{ t('spreed', 'You cannot lock a conversation while in a call!') }}</span>
</div>
</div>
</template>

<script>
import { showError, showSuccess } from '@nextcloud/dialogs'
import isInCall from '../../mixins/isInCall'
import participant from '../../mixins/participant'
import { CONVERSATION } from '../../constants'

export default {
name: 'LockingSettings',

mixins: [
isInCall,
participant,
],

props: {
token: {
type: String,
Expand Down
23 changes: 18 additions & 5 deletions src/components/ConversationSettings/SipSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
{{ t('spreed', 'Allow participants to join from a phone.') }}
</div>
<input id="sip_settings_checkbox"
v-model="hasSipEnabled"
aria-describedby="sip_settings_hint"
type="checkbox"
class="checkbox"
name="sip_settings_checkbox"
:checked="hasSIPEnabled"
:disabled="isSipLoading"
@change="toggleSIPEnabled">
@change="toggleSipEnabled">
<label for="sip_settings_checkbox">{{ t('spreed', 'Enable SIP dial-in') }}</label>
</div>
</template>
Expand All @@ -46,6 +46,7 @@ export default {
data() {
return {
isSipLoading: false,
newSipEnabled: null,
}
},

Expand All @@ -58,13 +59,22 @@ export default {
return this.$store.getters.conversation(this.token) || this.$store.getters.dummyConversation
},

hasSIPEnabled() {
return this.conversation.sipEnabled === WEBINAR.SIP.ENABLED
hasSipEnabled: {
get() {
if (this.newSipEnabled !== null) {
return this.newSipEnabled
}
return this.conversation.sipEnabled === WEBINAR.SIP.ENABLED
},
set(value) {
this.newSipEnabled = value
},
},
},

methods: {
async toggleSIPEnabled() {
async toggleSipEnabled(checked) {
this.isSipLoading = true
try {
await this.$store.dispatch('setSIPEnabled', {
token: this.token,
Expand All @@ -76,6 +86,8 @@ export default {
showSuccess(t('spreed', 'SIP dial-in is now disabled'))
}
} catch (e) {
// revert checkbox state
this.newSipEnabled = !checked
// TODO check "precondition failed"
if (!this.conversation.sipEnabled) {
console.error('Error occurred when enabling SIP dial-in', e)
Expand All @@ -85,6 +97,7 @@ export default {
showError(t('spreed', 'Error occurred when disabling SIP dial-in'))
}
}
this.isSipLoading = false
},
},
}
Expand Down