From c8f138e2bbf5b906473e5052c64dac56225482dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 26 Oct 2022 22:27:50 +0200 Subject: [PATCH 1/2] Do not show Talk sidebar in Files app if Talk is disabled for the user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Calviño Sánchez --- lib/Files/TemplateLoader.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Files/TemplateLoader.php b/lib/Files/TemplateLoader.php index f3fc1b6f575..c7fa5190e83 100644 --- a/lib/Files/TemplateLoader.php +++ b/lib/Files/TemplateLoader.php @@ -91,10 +91,14 @@ public function handle(Event $event): void { return; } + $user = $this->userSession->getUser(); + if ($user instanceof IUser && $this->talkConfig->isDisabledForUser($user)) { + return; + } + Util::addStyle(Application::APP_ID, 'merged-files'); Util::addScript(Application::APP_ID, 'talk-files-sidebar'); - $user = $this->userSession->getUser(); if ($user instanceof IUser) { $this->publishInitialStateForUser($user, $this->rootFolder, $this->appManager); } else { From 083733638affe8f83a060e8fe849d51aa5ae734b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Fri, 28 Oct 2022 01:19:31 +0200 Subject: [PATCH 2/2] Show error when failing to join a conversation in the public share page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Joining a conversation in the public share page fails if Talk use is limited to certain groups and the public share page is opened by a user not in those groups. The incognito mode is enabled when the public share page is loaded, so from the point of view of the event handler that adds the Talk sidebar script the user is always a guest, and therefore adding the script can not be prevented for users not allowed to use Talk. Moreover, when those users tried to join the conversation in the public share page the button was kept disabled with a loading spinner forever, and no error was shown to the user. For simplicity, and as it could be useful if joining the conversation fails for any other reason, instead of looking for other ways to hide the Talk sidebar if the user is not allowed to use Talk now, if joining the conversation in the public share page fails, the button is restored and an error toast is shown. Signed-off-by: Daniel Calviño Sánchez --- src/PublicShareSidebar.vue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/PublicShareSidebar.vue b/src/PublicShareSidebar.vue index dc6c70cda95..fa89749780f 100644 --- a/src/PublicShareSidebar.vue +++ b/src/PublicShareSidebar.vue @@ -49,6 +49,7 @@