From 1958ce4b2b50f58209fde93cd315b312b1b0c0f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 17 Dec 2020 14:42:22 +0100 Subject: [PATCH] MOBILE-3626 core: Improve get current site home id --- .../block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts | 2 +- .../components/self-enrol-password/self-enrol-password.html | 2 +- .../courses/pages/available-courses/available-courses.ts | 2 +- src/core/features/login/pages/credentials/credentials.html | 2 +- src/core/features/login/pages/email-signup/email-signup.html | 2 +- src/core/features/login/pages/reconnect/reconnect.html | 2 +- src/core/features/sitehome/pages/index/index.ts | 2 +- src/core/features/sitehome/services/sitehome.ts | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/addons/block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts b/src/addons/block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts index 4df2d9b89..5893d36cd 100644 --- a/src/addons/block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts +++ b/src/addons/block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts @@ -45,7 +45,7 @@ export class AddonBlockSiteMainMenuComponent extends CoreBlockBaseComponent impl * Component being initialized. */ async ngOnInit(): Promise { - this.siteHomeId = CoreSites.instance.getCurrentSite()?.getSiteHomeId() || 1; + this.siteHomeId = CoreSites.instance.getCurrentSiteHomeId(); super.ngOnInit(); } diff --git a/src/core/features/courses/components/self-enrol-password/self-enrol-password.html b/src/core/features/courses/components/self-enrol-password/self-enrol-password.html index ee4c213f3..470dc5d13 100644 --- a/src/core/features/courses/components/self-enrol-password/self-enrol-password.html +++ b/src/core/features/courses/components/self-enrol-password/self-enrol-password.html @@ -16,7 +16,7 @@
- + { - const frontpageCourseId = CoreSites.instance.getCurrentSite()!.getSiteHomeId(); + const frontpageCourseId = CoreSites.instance.getCurrentSiteHomeId(); try { const courses = await CoreCourses.instance.getCoursesByField(); diff --git a/src/core/features/login/pages/credentials/credentials.html b/src/core/features/login/pages/credentials/credentials.html index 498b4f7ec..5c0e22e74 100644 --- a/src/core/features/login/pages/credentials/credentials.html +++ b/src/core/features/login/pages/credentials/credentials.html @@ -39,7 +39,7 @@ - + diff --git a/src/core/features/login/pages/email-signup/email-signup.html b/src/core/features/login/pages/email-signup/email-signup.html index 95378a395..5fafd20e2 100644 --- a/src/core/features/login/pages/email-signup/email-signup.html +++ b/src/core/features/login/pages/email-signup/email-signup.html @@ -106,7 +106,7 @@ {{ 'core.login.password' | translate }} - + diff --git a/src/core/features/login/pages/reconnect/reconnect.html b/src/core/features/login/pages/reconnect/reconnect.html index ad4887437..2f3b4dfda 100644 --- a/src/core/features/login/pages/reconnect/reconnect.html +++ b/src/core/features/login/pages/reconnect/reconnect.html @@ -40,7 +40,7 @@ - + diff --git a/src/core/features/sitehome/pages/index/index.ts b/src/core/features/sitehome/pages/index/index.ts index e4beca68f..905c2a6f8 100644 --- a/src/core/features/sitehome/pages/index/index.ts +++ b/src/core/features/sitehome/pages/index/index.ts @@ -81,7 +81,7 @@ export class CoreSiteHomeIndexPage implements OnInit, OnDestroy { }, CoreSites.instance.getCurrentSiteId()); this.currentSite = CoreSites.instance.getCurrentSite()!; - this.siteHomeId = this.currentSite?.getSiteHomeId() || 1; + this.siteHomeId = CoreSites.instance.getCurrentSiteHomeId(); const module = navParams['module']; if (module) { diff --git a/src/core/features/sitehome/services/sitehome.ts b/src/core/features/sitehome/services/sitehome.ts index 9fd56c6a5..668891af7 100644 --- a/src/core/features/sitehome/services/sitehome.ts +++ b/src/core/features/sitehome/services/sitehome.ts @@ -47,7 +47,7 @@ export class CoreSiteHomeProvider { */ async getNewsForum(siteHomeId?: number): Promise { if (!siteHomeId) { - siteHomeId = CoreSites.instance.getCurrentSite()?.getSiteHomeId() || 1; + siteHomeId = CoreSites.instance.getCurrentSiteHomeId(); } const forums = await AddonModForum.instance.getCourseForums(siteHomeId);