From 828aac8982947098ac4fc045f0c1bb107fdad5bc 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 ada2ae1dd18..c129c1854b2 100644 --- a/lib/Files/TemplateLoader.php +++ b/lib/Files/TemplateLoader.php @@ -88,11 +88,15 @@ 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, 'At'); Util::addStyle(Application::APP_ID, 'icons'); 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 f287b8b9f489c5adadcad594ddb73bb6b3cf76fd 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 288ad25d42a..a16e2229c93 100644 --- a/src/PublicShareSidebar.vue +++ b/src/PublicShareSidebar.vue @@ -55,6 +55,7 @@