From 0e14ec6649c7c80938bfbb96160ded5bdb12c252 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Thu, 5 Aug 2021 18:45:06 +0200 Subject: [PATCH] =?UTF-8?q?Removed=20the=20settings=20=C2=ABChats=20are=20?= =?UTF-8?q?only=20available=20for=20local=20videos=C2=BB.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- CHANGELOG.md | 6 +++++- client/admin-plugin-client-plugin.ts | 2 -- server/lib/diagnostic/video.ts | 5 ----- server/lib/routers/api.ts | 2 -- server/lib/settings.ts | 18 ------------------ shared/lib/video.ts | 12 +++++------- 6 files changed, 10 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc9936da..8a4c2541 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/client/admin-plugin-client-plugin.ts b/client/admin-plugin-client-plugin.ts index 227abfd6..146758bf 100644 --- a/client/admin-plugin-client-plugin.ts +++ b/client/admin-plugin-client-plugin.ts @@ -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) } diff --git a/server/lib/diagnostic/video.ts b/server/lib/diagnostic/video.ts index 76e43ee9..6fd16f76 100644 --- a/server/lib/diagnostic/video.ts +++ b/server/lib/diagnostic/video.ts @@ -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.') diff --git a/server/lib/routers/api.ts b/server/lib/routers/api.ts index 9c6b2674..ce660091 100644 --- a/server/lib/routers/api.ts +++ b/server/lib/routers/api.ts @@ -106,7 +106,6 @@ async function initApiRouter (options: RegisterServerOptions): Promise { // 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 { 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'], diff --git a/server/lib/settings.ts b/server/lib/settings.ts index 098ffccd..72ac848a 100644 --- a/server/lib/settings.ts +++ b/server/lib/settings.ts @@ -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: -` - The plugin is not compatible with video federation yet. - The webchat will only be accessible for people watching videos on your server. -` - }) registerSetting({ name: 'chat-per-live-video', label: 'Users can activate the chat for their lives', diff --git a/shared/lib/video.ts b/shared/lib/video.ts index db3d81f8..c14f0f41 100644 --- a/shared/lib/video.ts +++ b/shared/lib/video.ts @@ -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']) {