44-->
55
66<script setup lang="ts">
7- import { computed } from ' vue'
7+ import { computed , reactive } from ' vue'
88
99import IconAccount from ' vue-material-design-icons/Account.vue'
1010import IconVolumeHigh from ' vue-material-design-icons/VolumeHigh.vue'
@@ -38,6 +38,13 @@ const showCallNotificationSettings = computed(() => {
3838 return ! props .conversation .remoteServer || hasTalkFeature (props .conversation .token , ' federation-v2' )
3939})
4040
41+ const loading = reactive ({
42+ level: false ,
43+ calls: false ,
44+ important: false ,
45+ sensitive: false ,
46+ })
47+
4148const notificationLevel = computed (() => props .conversation .notificationLevel .toString ())
4249
4350/**
@@ -47,39 +54,47 @@ const notificationLevel = computed(() => props.conversation.notificationLevel.to
4754 * @param value The notification level to set.
4855 */
4956async function setNotificationLevel(value : string ) {
57+ loading .level = true
5058 await store .dispatch (' setNotificationLevel' , {
5159 token: props .conversation .token ,
5260 notificationLevel: + value ,
5361 })
62+ loading .level = false
5463}
5564
5665const notifyCalls = computed ({
5766 get : () => props .conversation .notificationCalls === PARTICIPANT .NOTIFY_CALLS .ON ,
5867 set : async (value ) => {
68+ loading .calls = true
5969 await store .dispatch (' setNotificationCalls' , {
6070 token: props .conversation .token ,
6171 notificationCalls: value ? PARTICIPANT .NOTIFY_CALLS .ON : PARTICIPANT .NOTIFY_CALLS .OFF ,
6272 })
73+ loading .calls = false
6374 },
6475})
6576
6677const isImportant = computed ({
6778 get : () => props .conversation .isImportant ,
6879 set : async (value ) => {
80+ loading .important = true
6981 await store .dispatch (' toggleImportant' , {
7082 token: props .conversation .token ,
7183 isImportant: value ,
7284 })
85+ loading .important = false
7386 },
7487})
7588
7689const isSensitive = computed ({
7790 get : () => props .conversation .isSensitive ,
7891 set : async (value ) => {
92+ loading .sensitive = true
7993 await store .dispatch (' toggleSensitive' , {
8094 token: props .conversation .token ,
8195 isSensitive: value ,
8296 })
97+ loading .sensitive = false
8398 },
8499})
85100 </script >
@@ -94,6 +109,7 @@ const isSensitive = computed({
94109 :key =" level.value"
95110 :model-value =" notificationLevel"
96111 :value =" level.value.toString()"
112+ :disabled =" loading.level"
97113 name =" notification_level"
98114 type =" radio"
99115 @update:model-value =" setNotificationLevel" >
@@ -106,13 +122,15 @@ const isSensitive = computed({
106122 <NcCheckboxRadioSwitch v-if =" showCallNotificationSettings"
107123 id =" notification_calls"
108124 v-model =" notifyCalls"
125+ :disabled =" loading.calls"
109126 type =" switch" >
110127 {{ t('spreed', 'Notify about calls in this conversation') }}
111128 </NcCheckboxRadioSwitch >
112129
113130 <NcCheckboxRadioSwitch v-if =" supportImportantConversations"
114131 id =" important"
115132 v-model =" isImportant"
133+ :disabled =" loading.important"
116134 aria-describedby =" important-hint"
117135 type =" switch" >
118136 {{ t('spreed', 'Important conversation') }}
@@ -125,6 +143,7 @@ const isSensitive = computed({
125143 <NcCheckboxRadioSwitch v-if =" supportSensitiveConversations"
126144 id =" sensitive"
127145 v-model =" isSensitive"
146+ :disabled =" loading.sensitive"
128147 aria-describedby =" sensitive-hint"
129148 type =" switch" >
130149 {{ t('spreed', 'Sensitive conversation') }}
0 commit comments