Skip to content

Commit

Permalink
feat(config): create standard service request for user config
Browse files Browse the repository at this point in the history
Signed-off-by: DorraJaouad <[email protected]>
  • Loading branch information
DorraJaouad committed Oct 10, 2024
1 parent 8962c40 commit e1e1c8a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/components/SettingsDialog/SettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ import { PRIVACY } from '../../constants.js'
import BrowserStorage from '../../services/BrowserStorage.js'
import { getTalkConfig } from '../../services/CapabilitiesManager.ts'
import { useCustomSettings } from '../../services/SettingsAPI.ts'
import { setUserConfig } from '../../services/settingsService.js'
import { useSettingsStore } from '../../stores/settings.js'
import { useSoundsStore } from '../../stores/sounds.js'
Expand Down Expand Up @@ -297,12 +298,11 @@ export default {
},
},
created() {
async created() {
const blurred = BrowserStorage.getItem('background-blurred')
if (blurred === 'false' && isBackgroundBlurred === '') {
console.debug('Blur was disabled intentionally, propagating last choice to server')
axios.post(generateOcsUrl('apps/provisioning_api/api/v1/config/users/theming/force_enable_blur_filter'),
{ configValue: 'no' })
await setUserConfig('theming', 'force_enable_blur_filter', 'no')
}
BrowserStorage.removeItem('background-blurred')
},
Expand Down
17 changes: 15 additions & 2 deletions src/services/settingsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,20 @@ const setPlaySounds = async function(hasUserAccount, value) {
}

const setStartWithoutMedia = async function(value) {
await axios.post(generateOcsUrl('apps/provisioning_api/api/v1/config/users/spreed/calls_start_without_media'),
{ configValue: value ? 'yes' : 'no' })
await setUserConfig('spreed', 'calls_start_without_media', value ? 'yes' : 'no')
}

/**
* Set user config using provisioning API
*
* @param {string} appId - app id
* @param {string} configKey - key of the config to set
* @param {string} configValue - value to set
*/
const setUserConfig = async function(appId, configKey, configValue) {
await axios.post(generateOcsUrl('apps/provisioning_api/api/v1/config/users/{appId}/{configKey}', { appId, configKey }), {
configValue,
})
}

export {
Expand All @@ -86,4 +98,5 @@ export {
setSIPSettings,
setPlaySounds,
setStartWithoutMedia,
setUserConfig,
}

0 comments on commit e1e1c8a

Please sign in to comment.