Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOBILE-4723 my: Allow again showing myoverview in my courses page #4270

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/core/classes/delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ export class CoreDelegate<HandlerType extends CoreDelegateHandler> {
* @returns Function returned value or default value.
*/
protected hasFunction(handlerName: string, fnName: string, onlyEnabled: boolean = true): boolean {
const handler = onlyEnabled ? this.enabledHandlers[handlerName] : this.handlers[handlerName];
const handler = this.getHandler(handlerName, onlyEnabled);

return handler && typeof handler[fnName] == 'function';
return handler && typeof handler[fnName] === 'function';
}

/**
Expand All @@ -204,7 +204,7 @@ export class CoreDelegate<HandlerType extends CoreDelegateHandler> {
* @returns If the handler is registered or not.
*/
hasHandler(name: string, enabled: boolean = false): boolean {
return enabled ? this.enabledHandlers[name] !== undefined : this.handlers[name] !== undefined;
return this.getHandler(name, enabled) !== undefined;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/core/features/block/components/block/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class CoreBlockComponent implements OnChanges, OnDestroy {
}

/**
* On destroy of the component, clear up any subscriptions.
* @inheritdoc
*/
ngOnDestroy(): void {
this.blockSubscription?.unsubscribe();
Expand Down
3 changes: 2 additions & 1 deletion src/core/features/block/services/block-delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ export class CoreBlockDelegateService extends CoreDelegate<CoreBlockHandler> {
* @inheritdoc
*/
async isEnabled(): Promise<boolean> {
return !this.areBlocksDisabledInSite();
// Always return true, to allow displaying my overview even if all blocks are disabled, to avoid having an empty My Courses.
return true;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/core/features/courses/pages/my/my.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class CoreCoursesMyPage implements OnInit, OnDestroy, AsyncDirective {
);

// My overview block should always be in main blocks, but check side blocks too just in case.
this.loadedBlock = blocks.mainBlocks.concat(blocks.sideBlocks).find((block) => block.name == 'myoverview');
this.loadedBlock = blocks.mainBlocks.concat(blocks.sideBlocks).find((block) => block.name === 'myoverview');
this.hasSideBlocks = supportsMyParam && CoreBlockDelegate.hasSupportedBlock(blocks.sideBlocks);

await CoreWait.nextTicks(2);
Expand Down
Loading