Remove backward compatibility (registerSettingsScript).

This commit is contained in:
John Livingston 2021-06-02 12:32:00 +02:00
parent a1d5d83cc5
commit 56f1c5895e
2 changed files with 21 additions and 24 deletions

View File

@ -47,8 +47,7 @@ interface RegisterClientSettingsScript {
interface RegisterOptions {
registerHook: (options: RegisterClientHookOptions) => void
peertubeHelpers: RegisterClientHelpers
// registerSettingsScript comes with Peertube 3.2.0.
registerSettingsScript?: (options: RegisterClientSettingsScript) => void
registerSettingsScript: (options: RegisterClientSettingsScript) => void
}
interface Video {

View File

@ -3,29 +3,27 @@ const converseSettings = ['chat-server', 'chat-room', 'chat-bosh-uri', 'chat-ws-
const otherSettings: string[] = []
function register ({ registerSettingsScript }: RegisterOptions): void {
if (registerSettingsScript) {
registerSettingsScript({
isSettingHidden: options => {
const name = options.setting.name
if (prosodySettings.includes(name)) {
return options.formValues['chat-use-prosody'] !== true
}
if (name === 'chat-use-builtin') {
return options.formValues['chat-use-prosody'] === true
}
if (converseSettings.includes(name)) {
return options.formValues['chat-use-builtin'] !== true || options.formValues['chat-use-prosody'] === true
}
if (name === 'chat-uri') {
return options.formValues['chat-use-prosody'] === true || options.formValues['chat-use-builtin'] === true
}
if (otherSettings.includes(name)) {
return options.formValues['chat-use-builtin'] === true || options.formValues['chat-use-prosody'] === true
}
return false
registerSettingsScript({
isSettingHidden: options => {
const name = options.setting.name
if (prosodySettings.includes(name)) {
return options.formValues['chat-use-prosody'] !== true
}
})
}
if (name === 'chat-use-builtin') {
return options.formValues['chat-use-prosody'] === true
}
if (converseSettings.includes(name)) {
return options.formValues['chat-use-builtin'] !== true || options.formValues['chat-use-prosody'] === true
}
if (name === 'chat-uri') {
return options.formValues['chat-use-prosody'] === true || options.formValues['chat-use-builtin'] === true
}
if (otherSettings.includes(name)) {
return options.formValues['chat-use-builtin'] === true || options.formValues['chat-use-prosody'] === true
}
return false
}
})
}
export {