diff --git a/src/addons/mod/forum/pages/discussion/discussion.ts b/src/addons/mod/forum/pages/discussion/discussion.ts index e4d69c9fd..522ec6a07 100644 --- a/src/addons/mod/forum/pages/discussion/discussion.ts +++ b/src/addons/mod/forum/pages/discussion/discussion.ts @@ -58,6 +58,7 @@ import { ADDON_MOD_FORUM_MARK_READ_EVENT, ADDON_MOD_FORUM_REPLY_DISCUSSION_EVENT, } from '../../constants'; +import { CoreCourseContentsPage } from '@features/course/pages/contents/contents'; type SortType = 'flat-newest' | 'flat-oldest' | 'nested'; @@ -133,6 +134,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes @Optional() protected splitView: CoreSplitViewComponent, protected elementRef: ElementRef, protected route: ActivatedRoute, + @Optional() protected courseContentsPage?: CoreCourseContentsPage, ) {} get isMobile(): boolean { @@ -316,7 +318,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes } if (this.splitView?.outletActivated) { - CoreNavigator.navigate('../'); + CoreNavigator.navigate((this.courseContentsPage ? '../' : '') + '../'); } else { CoreNavigator.back(); } diff --git a/src/addons/mod/forum/pages/new-discussion/new-discussion.ts b/src/addons/mod/forum/pages/new-discussion/new-discussion.ts index a3ae2f2d4..7c798803a 100644 --- a/src/addons/mod/forum/pages/new-discussion/new-discussion.ts +++ b/src/addons/mod/forum/pages/new-discussion/new-discussion.ts @@ -51,6 +51,7 @@ import { ADDON_MOD_FORUM_COMPONENT, ADDON_MOD_FORUM_NEW_DISCUSSION_EVENT, } from '../../constants'; +import { CoreCourseContentsPage } from '@features/course/pages/contents/contents'; type NewDiscussionData = { subject: string; @@ -114,7 +115,11 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea protected initialGroupId?: number; protected logView: () => void; - constructor(protected route: ActivatedRoute, @Optional() protected splitView: CoreSplitViewComponent) { + constructor( + protected route: ActivatedRoute, + @Optional() protected splitView: CoreSplitViewComponent, + @Optional() protected courseContentsPage?: CoreCourseContentsPage, + ) { this.logView = CoreTime.once(() => { CoreAnalytics.logEvent({ type: CoreAnalyticsEventType.VIEW_ITEM, @@ -678,7 +683,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea */ protected goBack(): void { if (this.splitView?.outletActivated) { - CoreNavigator.navigate('../../'); + CoreNavigator.navigate((this.courseContentsPage ? '../' : '') + '../../'); } else { CoreNavigator.back(); }