From de6ab15805226f4a6beaf0fbb29f0685f93b96aa Mon Sep 17 00:00:00 2001 From: John Livingston Date: Wed, 19 Jun 2024 12:49:35 +0200 Subject: [PATCH] Task list: make it available in OBS docks. --- conversejs/builtin.ts | 22 +++++++++++++++---- .../plugins/tasks/styles/muc-task-app.scss | 1 + .../plugins/tasks/styles/muc-task-lists.scss | 1 + .../plugins/tasks/styles/muc-tasks.scss | 1 + 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/conversejs/builtin.ts b/conversejs/builtin.ts index 2e68c7a8..1304b845 100644 --- a/conversejs/builtin.ts +++ b/conversejs/builtin.ts @@ -121,9 +121,11 @@ async function initConverse ( const tryOIDC = (initConverseParams.externalAuthOIDC?.length ?? 0) > 0 let auth + let usedLivechatToken = false if (chatIncludeMode === 'chat-only') { // In this mode, we can check if there is a token in the url. auth = getLivechatTokenAuthInfos() + if (auth) { usedLivechatToken = true } } auth ??= await getLocalAuthentInfos(authenticationUrl, tryOIDC, peertubeAuthHeader) @@ -204,12 +206,24 @@ async function initConverse ( params.livechat_mini_muc_head = true // we must replace the muc-head by the custom buttons toolbar. } + // We enable task list only if we are in the peertube interface, or if: + // * mode === chat-only + !transparent + !readonly + is using a livechat token + // Technically it would work in 'chat-only' mode, but i don't want to add too many things to test + // (and i now there is some CSS bugs in the task list). + let enableTask = false if (chatIncludeMode === 'peertube-video' || chatIncludeMode === 'peertube-fullpage') { - // We enable task list only if we are in the peertube interface. - // Technically it would work in 'chat-only' mode, but i don't want to add too many things to test - // (and i now there is some CSS bugs in the task list). + enableTask = true + } else if ( + chatIncludeMode === 'chat-only' && + usedLivechatToken && + !initConverseParams.transparent && + !initConverseParams.forceReadonly + ) { + enableTask = true + } + if (enableTask) { params.livechat_task_app_enabled = true - params.livechat_task_app_restore = chatIncludeMode === 'peertube-fullpage' + params.livechat_task_app_restore = chatIncludeMode === 'peertube-fullpage' || chatIncludeMode === 'chat-only' } try { diff --git a/conversejs/custom/plugins/tasks/styles/muc-task-app.scss b/conversejs/custom/plugins/tasks/styles/muc-task-app.scss index 7a73afb6..e636a57e 100644 --- a/conversejs/custom/plugins/tasks/styles/muc-task-app.scss +++ b/conversejs/custom/plugins/tasks/styles/muc-task-app.scss @@ -29,6 +29,7 @@ } .livechat-converse-muc-app-close { + background: unset; border: 0; } } diff --git a/conversejs/custom/plugins/tasks/styles/muc-task-lists.scss b/conversejs/custom/plugins/tasks/styles/muc-task-lists.scss index d8e5289f..371cbd11 100644 --- a/conversejs/custom/plugins/tasks/styles/muc-task-lists.scss +++ b/conversejs/custom/plugins/tasks/styles/muc-task-lists.scss @@ -25,6 +25,7 @@ .task-list-toggle-tasks, .task-list-action { + background: unset; border: 0; padding-left: 0.25em; padding-right: 0.25em; diff --git a/conversejs/custom/plugins/tasks/styles/muc-tasks.scss b/conversejs/custom/plugins/tasks/styles/muc-tasks.scss index c95e76c1..df512e81 100644 --- a/conversejs/custom/plugins/tasks/styles/muc-tasks.scss +++ b/conversejs/custom/plugins/tasks/styles/muc-tasks.scss @@ -25,6 +25,7 @@ } .task-action { + background: unset; border: 0; padding-left: 0.25em; padding-right: 0.25em;