Removed the settings «Chats are only available for local videos».

From now on, webchat can only be activated for local videos.
It will never be displayed on remote videos.
This is because an incompatibility with a new feature (webchat per channel).
Moreover this feature was very limited: the webchat was not shared with the remote instance (this will probably be achieved in a future release).
This commit is contained in:
John Livingston 2021-08-05 18:45:06 +02:00
parent 14a87be859
commit 0e14ec6649
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
6 changed files with 10 additions and 35 deletions

View File

@ -1,6 +1,10 @@
# Changelog
## ???
## v4.0.0
### Breaking changes
* Removed the settings «Chats are only available for local videos». From now on, webchat can only be activated for local videos. It will never be displayed on remote videos. This is because an incompatibility with a new feature (webchat per channel). Moreover this feature was very limited: the webchat was not shared with the remote instance (this will probably be achieved in a future release).
### Features

View File

@ -208,8 +208,6 @@ function register ({ registerHook, registerSettingsScript, peertubeHelpers }: Re
return options.formValues['chat-type'] !== ('external-uri' as ChatType)
case 'chat-style':
return options.formValues['chat-type'] === 'disabled'
case 'chat-only-locals-warning':
return options.formValues['chat-only-locals'] === true
case 'chat-per-live-video-warning':
return !(options.formValues['chat-all-lives'] === true && options.formValues['chat-per-live-video'] === true)
}

View File

@ -6,7 +6,6 @@ export async function diagVideo (test: string, { settingsManager }: RegisterServ
const videoSettings = await settingsManager.getSettings([
'chat-auto-display',
'chat-open-blank',
'chat-only-locals',
'chat-per-live-video',
'chat-all-lives',
'chat-all-non-lives',
@ -22,10 +21,6 @@ export async function diagVideo (test: string, { settingsManager }: RegisterServ
result.messages.push('Displaying «open in new window» button')
}
if (videoSettings['chat-only-locals']) {
result.messages.push('Chat will only be available for local videos')
}
let atLeastOne: boolean = false
if (videoSettings['chat-per-live-video']) {
result.messages.push('Chat can be enabled on live videos.')

View File

@ -106,7 +106,6 @@ async function initApiRouter (options: RegisterServerOptions): Promise<Router> {
// check settings (chat enabled for this video?)
const settings = await options.settingsManager.getSettings([
'chat-type',
'chat-only-locals',
'chat-per-live-video',
'chat-all-lives',
'chat-all-non-lives',
@ -118,7 +117,6 @@ async function initApiRouter (options: RegisterServerOptions): Promise<Router> {
return
}
if (!videoHasWebchat({
'chat-only-locals': !!settings['chat-only-locals'],
'chat-per-live-video': !!settings['chat-per-live-video'],
'chat-all-lives': !!settings['chat-all-lives'],
'chat-all-non-lives': !!settings['chat-all-non-lives'],

View File

@ -210,24 +210,6 @@ Example : https://my_domain/conversejs.html?room=video_{{VIDEO_UUID}}.`,
type: 'input-checkbox',
default: true
})
registerSetting({
name: 'chat-only-locals',
label: 'Chats are only available for local videos.',
descriptionHTML: 'If you uncheck this settings, the chat will also be enabled on remote videos.',
type: 'input-checkbox',
default: true,
private: false
})
registerSetting({
name: 'chat-only-locals-warning',
type: 'html',
private: true,
descriptionHTML:
`<span class="peertube-plugin-livechat-warning">
The plugin is not compatible with video federation yet.
The webchat will only be accessible for people watching videos on your server.
</span>`
})
registerSetting({
name: 'chat-per-live-video',
label: 'Users can activate the chat for their lives',

View File

@ -1,7 +1,6 @@
import { parseConfigUUIDs } from './config'
interface SharedSettings {
'chat-only-locals': boolean
'chat-per-live-video': boolean
'chat-all-lives': boolean
'chat-all-non-lives': boolean
@ -27,12 +26,11 @@ interface SharedVideoBackend extends SharedVideoBase {
type SharedVideo = SharedVideoBackend | SharedVideoFrontend
function videoHasWebchat (settings: SharedSettings, video: SharedVideo): boolean {
if (settings['chat-only-locals']) {
if ('isLocal' in video) {
if (!video.isLocal) return false
} else {
if (video.remote) return false
}
// Never use webchat on remote videos.
if ('isLocal' in video) {
if (!video.isLocal) return false
} else {
if (video.remote) return false
}
if (settings['chat-per-live-video'] && video.isLive && video.pluginData && video.pluginData['livechat-active']) {