Replacing old settings by chat-type.

This commit is contained in:
John Livingston
2021-06-03 11:46:11 +02:00
parent 36146ee76c
commit d0b44c3486
7 changed files with 54 additions and 82 deletions

View File

@ -1,27 +1,29 @@
import { newResult, TestResult } from './utils'
import type { ChatType } from '../../../shared/lib/types'
export async function diagChatType (test: string, { settingsManager }: RegisterServerOptions): Promise<TestResult> {
const result = newResult(test)
const typeSettings = await settingsManager.getSettings([
'chat-use-prosody',
'chat-use-builtin',
'chat-uri'
'chat-type'
])
result.label = 'Webchat type'
if (typeSettings['chat-use-prosody'] as boolean) {
const chatType: ChatType = (typeSettings['chat-type'] ?? 'disabled') as ChatType
if (chatType === 'builtin-prosody') {
result.messages.push('Using builtin Prosody')
result.ok = true
result.next = 'prosody'
} else if (typeSettings['chat-use-builtin'] as boolean) {
} else if (chatType === 'builtin-converse') {
result.messages.push('Using builtin ConverseJS to connect to an external XMPP server')
result.ok = true
result.next = 'converse'
} else if (((typeSettings['chat-uri'] || '') as string) !== '') {
} else if (chatType === 'external-uri') {
result.messages.push('Using an external uri')
result.ok = true
result.next = 'use-uri'
} else if (chatType === 'disabled') {
result.messages.push('Webchat disabled')
} else {
result.messages.push('No webchat configuration')
result.messages.push('Unknown chat type value: ' + (chatType as string))
}
return result
}