MOBILE-4623 forum: Fix issues with single activity format

main
Dani Palou 2024-07-25 10:40:22 +02:00
parent 5643e89c95
commit 2e09325eef
2 changed files with 10 additions and 3 deletions

View File

@ -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();
}

View File

@ -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();
}