From 61a33c7fff0b72d9a8c820a79efdcbb6a3e70f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 6 Nov 2024 14:14:10 +0100 Subject: [PATCH] MOBILE-4653 sitehome: Decouple forum from sitehome --- src/core/features/sitehome/services/sitehome.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/features/sitehome/services/sitehome.ts b/src/core/features/sitehome/services/sitehome.ts index 3dcf98555..3594f103c 100644 --- a/src/core/features/sitehome/services/sitehome.ts +++ b/src/core/features/sitehome/services/sitehome.ts @@ -19,7 +19,7 @@ import { CoreSite } from '@classes/sites/site'; import { makeSingleton } from '@singletons'; import { CoreCourse } from '../../course/services/course'; import { CoreCourses } from '../../courses/services/courses'; -import { AddonModForum, AddonModForumData } from '@addons/mod/forum/services/forum'; +import { AddonModForumData } from '@addons/mod/forum/services/forum'; import { CoreError } from '@classes/errors/error'; import { CoreBlockHelper } from '@features/block/services/block-helper'; import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site'; @@ -53,6 +53,8 @@ export class CoreSiteHomeProvider { siteHomeId = CoreSites.getCurrentSiteHomeId(); } + const { AddonModForum } = await import('@addons/mod/forum/services/forum'); + const forums = await AddonModForum.getCourseForums(siteHomeId); const forum = forums.find((forum) => forum.type == 'news'); @@ -67,9 +69,10 @@ export class CoreSiteHomeProvider { * Invalidate the WS call to get the news forum for the Site Home. * * @param siteHomeId Site Home ID. - * @returns Promise resolved when invalidated. */ async invalidateNewsForum(siteHomeId: number): Promise { + const { AddonModForum } = await import('@addons/mod/forum/services/forum'); + await AddonModForum.invalidateForumData(siteHomeId); }