fix(sounds): fall back when the server has no play-sounds capability - #19239
Conversation
|
Hi @bakiburakogun thanks for your frequent involvement. In case you are interested you can send me an email to |
|
Thanks a lot @nickvergessen, glad it's useful. I'll get in touch by email about the developer chat, and the conference sounds great, I'll see if I can make it to Berlin. Side note: the Psalm failure here doesn't seem related to this change (no PHP touched), the other recent PRs show the same error in |
6a103d8 to
88e0bf6
Compare
|
All three applied. The capability is read once at module level now, and the fallback order is the one you sketched. I kept your order as written, so a guest with a remembered value still wins over the capability. Say so if you meant the capability to come first for guests as well. Dropping Tests updated accordingly: the two |
Since Talk 24 the sounds store takes the user's "play sounds" setting from the capabilities (config.call.play-sounds). Servers before Talk 24 don't expose it there, so against such a server getTalkConfig() returns undefined, sounds are off after every start and the toggle in the settings dialog doesn't stick. Read the capability once. Guests keep what this browser remembered, otherwise the capability decides; without it, fall back to the value in browser storage and finally to enabled. On change, pass the capability along to setPlaySounds: a server that cannot hand the value back is not written to either, and the setting stays in the browser. Ref nextcloud/talk-desktop#1087 Signed-off-by: Baki Burak Ogun <63836730+bakiburakogun@users.noreply.github.com>
88e0bf6 to
fc22ff9
Compare
- setPlaySounds mock was unnecessary, since it skipped BrowserStorage call - mock axios.post instead Assisted-by: ClaudeCode:claude-sonnet-5 Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
Antreesy
left a comment
There was a problem hiding this comment.
Checked locally, adjusted test so they don't contradict (e.g. BrowserStorage.setItem should be called for guests) - see last commit
a guest with a remembered value still wins over the capability
Correct, otherwise they won't be able to rewrite it
I removed it rather than keep both.
Yup, service function already takes care of it
Thanks again!
|
/backport to stable35 |
|
/backport to stable34 |
☑️ Resolves
Since Talk 24 the sounds store reads the user's "play sounds" setting from the capabilities (
config.call.play-sounds). That works against a Talk 24+ server, but servers before Talk 24 don't have that capability at all, sogetTalkConfig('local', 'call', 'play-sounds')returnsundefinedthere: sounds are off after every start and the toggle in the settings dialog doesn't stick, which is the talk-desktop issue above again (the 2.2.x desktop client bundles the Talk 24 frontend and still supports NC 32/33 servers), just with the default flipped to silent.The capability is read once at module level and stays the first source for users; for older servers there are two fallbacks:
Guests are unchanged: browser storage first, then the capability (
guests_play_sounds), then enabled. On change,setPlaySounds()getshasUserAccount && hasPlaySoundsCapability, so a server that can't hand the value back isn't written to either and the setting stays in the browser. Against Talk 24+ nothing changes.Known limitation on older servers: a change made in another browser/device isn't picked up until the toggle is used locally, since there is no way to read the value back. That's the same trade-off @Antreesy described in the linked issue.
Added a small spec for the store's initial value and the action; the store computes its initial value at import time, so the tests reload the module.
🖼️ Screenshots
n/a
🚧 Tasks
🏁 Checklist
docs/is updated or not required