diff --git a/src/core/classes/site.ts b/src/core/classes/site.ts index 7b03c32bf..201b23ba1 100644 --- a/src/core/classes/site.ts +++ b/src/core/classes/site.ts @@ -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. */ diff --git a/src/core/directives/collapsible-header.ts b/src/core/directives/collapsible-header.ts index 656d5d15e..0249849c3 100644 --- a/src/core/directives/collapsible-header.ts +++ b/src/core/directives/collapsible-header.ts @@ -107,7 +107,7 @@ export class CoreCollapsibleHeaderDirective implements OnDestroy { } // Wait animations to finish. - const animations = this.content.getAnimations(); + const animations = (this.content.getAnimations && this.content.getAnimations()) || []; await Promise.all(animations.map(async (animation) => { await animation.finished; })); diff --git a/src/core/features/sitehome/services/handlers/sitehome-home.ts b/src/core/features/sitehome/services/handlers/sitehome-home.ts index f5866cda7..dfae92fd4 100644 --- a/src/core/features/sitehome/services/handlers/sitehome-home.ts +++ b/src/core/features/sitehome/services/handlers/sitehome-home.ts @@ -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',