From ad86d6e6e03f469d05f758cf3abb2942c8e28585 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Mon, 28 Nov 2022 17:18:16 +0100 Subject: [PATCH] MOBILE-4059 core: Fix support help for guests --- .../features/login/pages/credentials/credentials.ts | 1 + src/core/features/login/pages/reconnect/reconnect.ts | 1 + src/core/features/user/services/support.ts | 10 ++++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/features/login/pages/credentials/credentials.ts b/src/core/features/login/pages/credentials/credentials.ts index dac04dec0..3381b199d 100644 --- a/src/core/features/login/pages/credentials/credentials.ts +++ b/src/core/features/login/pages/credentials/credentials.ts @@ -138,6 +138,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy { CoreUserSupport.showHelp( Translate.instant('core.login.credentialshelp'), Translate.instant('core.login.credentialssupportsubject'), + this.supportConfig, ); } diff --git a/src/core/features/login/pages/reconnect/reconnect.ts b/src/core/features/login/pages/reconnect/reconnect.ts index bd4bcb3a1..d5089499b 100644 --- a/src/core/features/login/pages/reconnect/reconnect.ts +++ b/src/core/features/login/pages/reconnect/reconnect.ts @@ -149,6 +149,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy { CoreUserSupport.showHelp( Translate.instant('core.login.reconnecthelp'), Translate.instant('core.login.reconnectsupportsubject'), + this.supportConfig, ); } diff --git a/src/core/features/user/services/support.ts b/src/core/features/user/services/support.ts index 72c6cb84e..beefcb5e3 100644 --- a/src/core/features/user/services/support.ts +++ b/src/core/features/user/services/support.ts @@ -25,6 +25,7 @@ import { CoreSubscriptions } from '@singletons/subscriptions'; import { AlertButton } from '@ionic/angular'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreLang } from '@services/lang'; +import { CoreUserNullSupportConfig } from '@features/user/classes/support/null-support-config'; /** * Handle site support. @@ -57,10 +58,15 @@ export class CoreUserSupportService { * @param message Help message. * @param supportSubject Support subject. */ - showHelp(message: string, supportSubject: string): void { - const supportConfig = CoreUserAuthenticatedSupportConfig.forCurrentSite(); + showHelp(message: string, supportSubject: string, supportConfig?: CoreUserSupportConfig): void { const buttons: (AlertButton | string)[] = []; + if (!supportConfig) { + const site = CoreSites.getCurrentSite(); + + supportConfig = site ? new CoreUserAuthenticatedSupportConfig(site) : new CoreUserNullSupportConfig(); + } + if (supportConfig.canContactSupport()) { buttons.push({ text: Translate.instant('core.contactsupport'),