diff --git a/src/addons/mod/forum/components/index/index.html b/src/addons/mod/forum/components/index/index.html index db45724cc..b97db7da1 100644 --- a/src/addons/mod/forum/components/index/index.html +++ b/src/addons/mod/forum/components/index/index.html @@ -11,12 +11,12 @@ [priority]="750" content="{{'addon.blog.blog' | translate}}" [iconAction]="'far-newspaper'" (action)="gotoBlog()"> @@ -39,11 +39,11 @@ - + - + @@ -158,7 +158,7 @@ diff --git a/src/addons/mod/forum/components/index/index.ts b/src/addons/mod/forum/components/index/index.ts index 4e6178c66..2312f7ff4 100644 --- a/src/addons/mod/forum/components/index/index.ts +++ b/src/addons/mod/forum/components/index/index.ts @@ -73,7 +73,6 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom moduleName = 'forum'; descriptionNote?: string; forum?: AddonModForumData; - fetchMoreDiscussionsFailed = false; discussions: AddonModForumDiscussionsManager; canAddDiscussion = false; addDiscussionText!: string; @@ -237,7 +236,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom * @param showErrors Wether to show errors to the user or hide them. */ protected async fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { - this.fetchMoreDiscussionsFailed = false; + this.discussions.fetchFailed = false; const promises: Promise[] = []; @@ -259,7 +258,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom if (refresh) { CoreDomUtils.showErrorModalDefault(error, 'addon.mod_forum.errorgetforum', true); - this.fetchMoreDiscussionsFailed = true; // Set to prevent infinite calls with infinite-loading. + this.discussions.fetchFailed = true; // Set to prevent infinite calls with infinite-loading. } else { // Get forum failed, retry without using cache since it might be a new activity. await this.refreshContent(sync); @@ -422,7 +421,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom */ protected async fetchDiscussions(refresh: boolean): Promise { const forum = this.forum!; - this.fetchMoreDiscussionsFailed = false; + this.discussions.fetchFailed = false; if (refresh) { this.page = 0; @@ -497,7 +496,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom } catch (error) { CoreDomUtils.showErrorModalDefault(error, 'addon.mod_forum.errorgetforum', true); - this.fetchMoreDiscussionsFailed = true; + this.discussions.fetchFailed = true; } finally { complete(); } @@ -715,6 +714,7 @@ type DiscussionItem = AddonModForumDiscussion | AddonModForumOfflineDiscussion | class AddonModForumDiscussionsManager extends CorePageItemsListManager { onlineLoaded = false; + fetchFailed = false; private discussionsPathPrefix: string; private component: AddonModForumIndexComponent; @@ -726,6 +726,10 @@ class AddonModForumDiscussionsManager extends CorePageItemsListManager this.isOnlineDiscussion(discussion)) as AddonModForumDiscussion[]; } @@ -782,6 +786,7 @@ class AddonModForumDiscussionsManager extends CorePageItemsListManager !this.isOnlineDiscussion(discussion)); this.setItems(otherDiscussions.concat(onlineDiscussions), hasMoreItems); + this.onlineLoaded = true; } /** @@ -795,15 +800,6 @@ class AddonModForumDiscussionsManager extends CorePageItemsListManager this.isOnlineDiscussion(discussion)); - } - /** * @inheritdoc */