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 <dorra.jaoued7@gmail.com>
  • Loading branch information
DorraJaouad committed Oct 10, 2024
1 parent cf122cd commit 2c72135
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 @@ -206,6 +206,7 @@ import { getTalkConfig } from '../../services/CapabilitiesManager.ts'
import { useCustomSettings } from '../../services/SettingsAPI.ts'
import { useSettingsStore } from '../../stores/settings.js'
import { useSoundsStore } from '../../stores/sounds.js'
import { setUserConfig } from '../../services/settingsService.js'

Check failure on line 209 in src/components/SettingsDialog/SettingsDialog.vue

View workflow job for this annotation

GitHub Actions / NPM lint

`../../services/settingsService.js` import should occur before import of `../../stores/settings.js`
const isBackgroundBlurred = loadState('spreed', 'force_enable_blur_filter', '')
const supportTypingStatus = getTalkConfig('local', 'chat', 'typing-privacy') !== undefined
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 2c72135

Please sign in to comment.