diff --git a/docs/settings.md b/docs/settings.md
index 9a2589d6062..0f03c54d90c 100644
--- a/docs/settings.md
+++ b/docs/settings.md
@@ -134,6 +134,7 @@ Legend:
| `backgrounds_branded_for_guests` | string
`1` or `0` | `0` | No | | Whether guests are allowed to use the virtual backgrounds provided via `themes/talk-backgrounds/` |
| `backgrounds_default_for_users` | string
`1` or `0` | `1` | No | | Whether users are allowed to use the default virtual backgrounds provided by the releases |
| `backgrounds_upload_users` | string
`1` or `0` | `1` | No | | Whether users are allowed to upload custom virtual backgrounds and choose from their Nextcloud Files |
+| `guests_play_sounds` | string
`1` or `0` | `1` | No | | Whether guests hear the join and leave sounds by default |
## Experiments
diff --git a/lib/Config.php b/lib/Config.php
index 636416da4b9..3e9b4804f60 100644
--- a/lib/Config.php
+++ b/lib/Config.php
@@ -802,4 +802,8 @@ public function isCallEndToEndEncryptionEnabled(): bool {
// TODO Default value will be set to true, once all mobile clients support it.
return $this->appConfig->getAppValueBool('call_end_to_end_encryption');
}
+
+ public function getPlaySoundsDefaultForGuests(): bool {
+ return $this->appConfig->getAppValueBool('guests_play_sounds', true);
+ }
}
diff --git a/lib/TInitialState.php b/lib/TInitialState.php
index ae250c14ff5..23041b214f2 100644
--- a/lib/TInitialState.php
+++ b/lib/TInitialState.php
@@ -213,7 +213,7 @@ protected function publishInitialStateForGuest(): void {
$this->initialState->provideInitialState(
'play_sounds',
- false
+ $this->talkConfig->getPlaySoundsDefaultForGuests()
);
}
}
diff --git a/src/stores/sounds.js b/src/stores/sounds.js
index 5c0d5866d99..d6aedbc6160 100644
--- a/src/stores/sounds.js
+++ b/src/stores/sounds.js
@@ -14,9 +14,16 @@ const hasUserAccount = Boolean(getCurrentUser()?.uid)
/**
* Get play sounds option (from server for user or from browser storage for guest)
*/
-const shouldPlaySounds = hasUserAccount
- ? loadState('spreed', 'play_sounds', false)
- : BrowserStorage.getItem('play_sounds') !== 'no'
+let shouldPlaySounds = false
+if (hasUserAccount) {
+ shouldPlaySounds = loadState('spreed', 'play_sounds', false)
+} else {
+ if (BrowserStorage.getItem('play_sounds')) {
+ shouldPlaySounds = BrowserStorage.getItem('play_sounds') !== 'no'
+ } else {
+ shouldPlaySounds = loadState('spreed', 'play_sounds', false)
+ }
+}
/**
* Preferred version is the .ogg, with .flac fallback if .ogg is not supported (Safari)