MOBILE-3833 sitehome: Update userhomepage site info type

main
Pau Ferrer Ocaña 2021-12-15 12:30:35 +01:00
parent be68ff374e
commit a4c60925d9
2 changed files with 13 additions and 2 deletions

View File

@ -2118,7 +2118,7 @@ export type CoreSiteInfoResponse = {
usercanmanageownfiles?: boolean; // True if the user can manage his own files.
userquota?: number; // User quota (bytes). 0 means user can ignore the quota.
usermaxuploadfilesize?: number; // User max upload file size (bytes). -1 means the user can ignore the upload file size.
userhomepage?: number; // The default home page for the user: 0 for the site home, 1 for dashboard.
userhomepage?: CoreSiteInfoUserHomepage; // The default home page for the user.
userprivateaccesskey?: string; // Private user access key for fetching files.
siteid?: number; // Site course ID.
sitecalendartype?: string; // Calendar type set in the site.
@ -2139,6 +2139,15 @@ export type CoreSiteInfo = CoreSiteInfoResponse & {
};
};
/**
* Enum constants that define default user home page.
*/
export enum CoreSiteInfoUserHomepage {
HOMEPAGE_SITE = 0, // Site home.
HOMEPAGE_MY = 1, // Dashboard.
HOMEPAGE_MYCOURSES = 3, // My courses.
};
/**
* Result of WS tool_mobile_get_config.
*/

View File

@ -17,6 +17,7 @@ import { CoreSites } from '@services/sites';
import { CoreMainMenuHomeHandler, CoreMainMenuHomeHandlerToDisplay } from '@features/mainmenu/services/home-delegate';
import { CoreSiteHome } from '../sitehome';
import { makeSingleton } from '@singletons';
import { CoreSiteInfoUserHomepage } from '@classes/site';
/**
* Handler to add site home into home page.
@ -55,7 +56,8 @@ export class CoreSiteHomeHomeHandlerService implements CoreMainMenuHomeHandler {
*/
getDisplayData(): CoreMainMenuHomeHandlerToDisplay {
const site = CoreSites.getCurrentSite();
const displaySiteHome = site?.getInfo() && site?.getInfo()?.userhomepage === 0;
const displaySiteHome = site?.getInfo() && site?.getInfo()?.userhomepage === CoreSiteInfoUserHomepage.HOMEPAGE_SITE;
return {
title: 'core.sitehome.sitehome',