Merge pull request #4270 from crazyserver/MOBILE-4723
MOBILE-4723 my: Allow again showing myoverview in my courses pagemain
commit
22cb658788
|
@ -191,9 +191,9 @@ export class CoreDelegate<HandlerType extends CoreDelegateHandler> {
|
||||||
* @returns Function returned value or default value.
|
* @returns Function returned value or default value.
|
||||||
*/
|
*/
|
||||||
protected hasFunction(handlerName: string, fnName: string, onlyEnabled: boolean = true): boolean {
|
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';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -204,7 +204,7 @@ export class CoreDelegate<HandlerType extends CoreDelegateHandler> {
|
||||||
* @returns If the handler is registered or not.
|
* @returns If the handler is registered or not.
|
||||||
*/
|
*/
|
||||||
hasHandler(name: string, enabled: boolean = false): boolean {
|
hasHandler(name: string, enabled: boolean = false): boolean {
|
||||||
return enabled ? this.enabledHandlers[name] !== undefined : this.handlers[name] !== undefined;
|
return this.getHandler(name, enabled) !== undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -101,7 +101,7 @@ export class CoreBlockComponent implements OnChanges, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On destroy of the component, clear up any subscriptions.
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.blockSubscription?.unsubscribe();
|
this.blockSubscription?.unsubscribe();
|
||||||
|
|
|
@ -114,7 +114,8 @@ export class CoreBlockDelegateService extends CoreDelegate<CoreBlockHandler> {
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
async isEnabled(): Promise<boolean> {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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.
|
// 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);
|
this.hasSideBlocks = supportsMyParam && CoreBlockDelegate.hasSupportedBlock(blocks.sideBlocks);
|
||||||
|
|
||||||
await CoreWait.nextTicks(2);
|
await CoreWait.nextTicks(2);
|
||||||
|
|
Loading…
Reference in New Issue