Merge pull request #3483 from NoelDeMartin/MOBILE-4059

MOBILE-4059 core: Fix support help for guests
main
Dani Palou 2022-11-29 12:24:28 +01:00 committed by GitHub
commit d893eca309
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -138,6 +138,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
CoreUserSupport.showHelp( CoreUserSupport.showHelp(
Translate.instant('core.login.credentialshelp'), Translate.instant('core.login.credentialshelp'),
Translate.instant('core.login.credentialssupportsubject'), Translate.instant('core.login.credentialssupportsubject'),
this.supportConfig,
); );
} }

View File

@ -149,6 +149,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
CoreUserSupport.showHelp( CoreUserSupport.showHelp(
Translate.instant('core.login.reconnecthelp'), Translate.instant('core.login.reconnecthelp'),
Translate.instant('core.login.reconnectsupportsubject'), Translate.instant('core.login.reconnectsupportsubject'),
this.supportConfig,
); );
} }

View File

@ -25,6 +25,7 @@ import { CoreSubscriptions } from '@singletons/subscriptions';
import { AlertButton } from '@ionic/angular'; import { AlertButton } from '@ionic/angular';
import { CoreDomUtils } from '@services/utils/dom'; import { CoreDomUtils } from '@services/utils/dom';
import { CoreLang } from '@services/lang'; import { CoreLang } from '@services/lang';
import { CoreUserNullSupportConfig } from '@features/user/classes/support/null-support-config';
/** /**
* Handle site support. * Handle site support.
@ -57,10 +58,15 @@ export class CoreUserSupportService {
* @param message Help message. * @param message Help message.
* @param supportSubject Support subject. * @param supportSubject Support subject.
*/ */
showHelp(message: string, supportSubject: string): void { showHelp(message: string, supportSubject: string, supportConfig?: CoreUserSupportConfig): void {
const supportConfig = CoreUserAuthenticatedSupportConfig.forCurrentSite();
const buttons: (AlertButton | string)[] = []; const buttons: (AlertButton | string)[] = [];
if (!supportConfig) {
const site = CoreSites.getCurrentSite();
supportConfig = site ? new CoreUserAuthenticatedSupportConfig(site) : new CoreUserNullSupportConfig();
}
if (supportConfig.canContactSupport()) { if (supportConfig.canContactSupport()) {
buttons.push({ buttons.push({
text: Translate.instant('core.contactsupport'), text: Translate.instant('core.contactsupport'),