forked from EVOgeek/Vmeda.Online
		
	MOBILE-3947 blocks: Check if blocks are disabled when loading filters
This commit is contained in:
		
							parent
							
								
									d7d4772252
								
							
						
					
					
						commit
						a05aba6bef
					
				| @ -16,6 +16,7 @@ import { Injectable } from '@angular/core'; | ||||
| import { CoreCourse, CoreCourseBlock } from '@features/course/services/course'; | ||||
| import { CoreBlockDelegate } from './block-delegate'; | ||||
| import { makeSingleton } from '@singletons'; | ||||
| import { CoreSite } from '@classes/sites/site'; | ||||
| 
 | ||||
| /** | ||||
|  * Service that provides helper functions for blocks. | ||||
| @ -26,10 +27,11 @@ export class CoreBlockHelperProvider { | ||||
|     /** | ||||
|      * Return if it get course blocks options is enabled for the current site. | ||||
|      * | ||||
|      * @param site Site. If not defined, current site. | ||||
|      * @returns true if enabled, false otherwise. | ||||
|      */ | ||||
|     canGetCourseBlocks(): boolean { | ||||
|         return CoreCourse.canGetCourseBlocks() && !CoreBlockDelegate.areBlocksDisabledInCourses(); | ||||
|     canGetCourseBlocks(site?: CoreSite): boolean { | ||||
|         return CoreCourse.canGetCourseBlocks(site) && !CoreBlockDelegate.areBlocksDisabledInCourses(site); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -32,6 +32,7 @@ import { CoreLogger } from '@singletons/logger'; | ||||
| import { CoreSite } from '@classes/sites/site'; | ||||
| import { CoreCourseHelper } from '@features/course/services/course-helper'; | ||||
| import { firstValueFrom } from 'rxjs'; | ||||
| import { CoreBlockHelper } from '@features/block/services/block-helper'; | ||||
| 
 | ||||
| /** | ||||
|  * Helper service to provide filter functionalities. | ||||
| @ -246,7 +247,7 @@ export class CoreFilterHelperProvider { | ||||
|                 const getFilters = () => this.getCourseContexts(instanceId, siteId); | ||||
| 
 | ||||
|                 return await this.getCacheableFilters(contextLevel, instanceId, getFilters, options, site); | ||||
|             } else if (contextLevel == 'block' && courseId && CoreCourse.canGetCourseBlocks(site)) { | ||||
|             } else if (contextLevel == 'block' && courseId && CoreBlockHelper.canGetCourseBlocks(site)) { | ||||
|                 // Get all the course blocks filters with a single call to decrease number of WS calls.
 | ||||
|                 const getFilters = () => this.getBlocksContexts(courseId, siteId); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user