MOBILE-4277 course: Show modules in course index
Including the ones that were previously hidden, such as text and label.
This commit is contained in:
		
							parent
							
								
									e14f5002d5
								
							
						
					
					
						commit
						7619d38fb7
					
				| @ -441,8 +441,10 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { | ||||
|                             await CoreCourseModuleDelegate.getModuleDataFor(module.modname, module, this.course.id); | ||||
|         } | ||||
| 
 | ||||
|         if (CoreCourseHelper.canUserViewModule(module, section) && module.handlerData?.action) { | ||||
|             module.handlerData.action(data.event, module, module.course); | ||||
|         if (CoreCourseHelper.canUserViewModule(module, section)) { | ||||
|             this.scrollToModule(module.id); | ||||
| 
 | ||||
|             module.handlerData?.action?.(data.event, module, module.course); | ||||
|         } | ||||
| 
 | ||||
|         this.moduleId = data.moduleId; | ||||
|  | ||||
| @ -18,9 +18,10 @@ import { | ||||
|     CoreCourseModuleCompletionTracking, | ||||
|     CoreCourseProvider, | ||||
| } from '@features/course/services/course'; | ||||
| import { CoreCourseHelper, CoreCourseSection } from '@features/course/services/course-helper'; | ||||
| import { CoreCourseHelper, CoreCourseModuleData, CoreCourseSection } from '@features/course/services/course-helper'; | ||||
| import { CoreCourseFormatDelegate } from '@features/course/services/format-delegate'; | ||||
| import { CoreCourseAnyCourseData } from '@features/courses/services/courses'; | ||||
| import { CoreSites } from '@services/sites'; | ||||
| import { CoreUtils } from '@services/utils/utils'; | ||||
| import { ModalController } from '@singletons'; | ||||
| import { CoreDom } from '@singletons/dom'; | ||||
| @ -79,7 +80,7 @@ export class CoreCourseCourseIndexComponent implements OnInit { | ||||
|             .filter((section) => !CoreCourseHelper.isSectionStealth(section)) | ||||
|             .map((section) => { | ||||
|                 const modules = section.modules | ||||
|                     .filter((module) => !CoreCourseHelper.isModuleStealth(module, section) && !module.noviewlink) | ||||
|                     .filter((module) => this.renderModule(section, module)) | ||||
|                     .map((module) => { | ||||
|                         const completionStatus = !completionEnabled || module.completiondata === undefined || | ||||
|                         module.completiondata.tracking == CoreCourseModuleCompletionTracking.COMPLETION_TRACKING_NONE | ||||
| @ -155,6 +156,27 @@ export class CoreCourseCourseIndexComponent implements OnInit { | ||||
|         ModalController.dismiss({ event, sectionId, moduleId }); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Check whether a module should be rendered or not. | ||||
|      * | ||||
|      * @param section Section. | ||||
|      * @param module Module | ||||
|      * @returns Whether the module should be rendered or not. | ||||
|      */ | ||||
|     protected renderModule(section: CoreCourseSection, module: CoreCourseModuleData): boolean { | ||||
|         if (CoreCourseHelper.isModuleStealth(module, section)) { | ||||
|             return false; | ||||
|         } | ||||
| 
 | ||||
|         const site = CoreSites.getRequiredCurrentSite(); | ||||
| 
 | ||||
|         if (site.isVersionGreaterEqualThan('4.2')) { | ||||
|             return true; | ||||
|         } | ||||
| 
 | ||||
|         return !module.noviewlink; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| type CourseIndexSection = { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user