Adding the chat-type field in the settings.

This commit is contained in:
John Livingston
2021-06-02 19:54:04 +02:00
parent 11d79fc611
commit 36146ee76c
5 changed files with 88 additions and 7 deletions

View File

@ -1,3 +1,4 @@
import type { ChatType } from 'shared/lib/types'
const prosodySettings = ['prosody-port']
const converseSettings = ['chat-server', 'chat-room', 'chat-bosh-uri', 'chat-ws-uri']
const otherSettings: string[] = []
@ -6,6 +7,18 @@ function register ({ registerSettingsScript }: RegisterOptions): void {
registerSettingsScript({
isSettingHidden: options => {
const name = options.setting.name
switch (name) {
case 'chat-type-help-disabled':
return options.formValues['chat-type'] !== ('disabled' as ChatType)
case 'chat-type-help-builtin-prosody':
return options.formValues['chat-type'] !== ('builtin-prosody' as ChatType)
case 'chat-type-help-builtin-converse':
return options.formValues['chat-type'] !== ('builtin-converse' as ChatType)
case 'chat-type-help-external-uri':
return options.formValues['chat-type'] !== ('external-uri' as ChatType)
}
// TODO: rewrite the code bellow.
if (prosodySettings.includes(name)) {
return options.formValues['chat-use-prosody'] !== true
}