MOBILE-3686 courses: Do not check my courses disabled on list
This commit is contained in:
		
							parent
							
								
									27ceb96127
								
							
						
					
					
						commit
						aef7a64db7
					
				| @ -12,7 +12,7 @@ | ||||
|                 <core-context-menu-item *ngIf="downloadCourseEnabled || downloadCoursesEnabled" [priority]="1000" | ||||
|                     [content]="'core.settings.showdownloadoptions' | translate" (action)="toggleDownload(!downloadEnabled)" | ||||
|                     iconAction="toggle" [toggle]="downloadEnabled"></core-context-menu-item> | ||||
|                 <core-context-menu-item *ngIf="myCoursesEnabled" [priority]="900" | ||||
|                 <core-context-menu-item [priority]="900" | ||||
|                     [content]="'core.courses.showonlyenrolled' | translate" (action)="toggleEnrolled(!showOnlyEnrolled)" | ||||
|                     iconAction="toggle" [toggle]="showOnlyEnrolled"></core-context-menu-item>    | ||||
|             </core-context-menu> | ||||
|  | ||||
| @ -36,7 +36,6 @@ export class CoreCoursesCategoriesPage implements OnInit, OnDestroy { | ||||
|     categories: CoreCategoryData[] = []; | ||||
|     courses: CoreCourseListItem[] = []; | ||||
|     categoriesLoaded = false; | ||||
|     myCoursesEnabled = true; | ||||
| 
 | ||||
|     showOnlyEnrolled = false; | ||||
| 
 | ||||
| @ -72,7 +71,6 @@ export class CoreCoursesCategoriesPage implements OnInit, OnDestroy { | ||||
|         this.siteUpdatedObserver = CoreEvents.on(CoreEvents.SITE_UPDATED, () => { | ||||
|             this.downloadCourseEnabled = !CoreCourses.isDownloadCourseDisabledInSite(); | ||||
|             this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); | ||||
|             this.myCoursesEnabled = !CoreCourses.isMyCoursesDisabledInSite(); | ||||
| 
 | ||||
|             this.downloadEnabled = (this.downloadCourseEnabled || this.downloadCoursesEnabled) && this.downloadEnabled; | ||||
|         }, this.currentSiteId); | ||||
| @ -91,7 +89,6 @@ export class CoreCoursesCategoriesPage implements OnInit, OnDestroy { | ||||
| 
 | ||||
|         this.downloadCourseEnabled = !CoreCourses.isDownloadCourseDisabledInSite(); | ||||
|         this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); | ||||
|         this.myCoursesEnabled = !CoreCourses.isMyCoursesDisabledInSite(); | ||||
| 
 | ||||
|         this.downloadEnabled = | ||||
|             (this.downloadCourseEnabled || this.downloadCoursesEnabled) && CoreCourses.getCourseDownloadOptionsEnabled(); | ||||
|  | ||||
| @ -148,11 +148,11 @@ export class CoreCoursesDashboardPage implements OnInit, OnDestroy { | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Convenience function to switch download enabled. | ||||
|      * Switch download enabled. | ||||
|      * | ||||
|      * @param enable If enable or disable. | ||||
|      */ | ||||
|     protected switchDownload(enable: boolean): void { | ||||
|     switchDownload(enable: boolean): void { | ||||
|         this.downloadEnabled = | ||||
|             CoreCourses.setCourseDownloadOptionsEnabled((this.downloadCourseEnabled || this.downloadCoursesEnabled) && enable); | ||||
|     } | ||||
|  | ||||
| @ -11,7 +11,7 @@ | ||||
|                 <core-context-menu-item *ngIf="downloadCourseEnabled || downloadCoursesEnabled" [priority]="1000" | ||||
|                     [content]="'core.settings.showdownloadoptions' | translate" (action)="toggleDownload(!downloadEnabled)" | ||||
|                     iconAction="toggle" [toggle]="downloadEnabled"></core-context-menu-item> | ||||
|                 <core-context-menu-item *ngIf="myCoursesEnabled" [priority]="900" | ||||
|                 <core-context-menu-item [priority]="900" | ||||
|                     [content]="'core.courses.showonlyenrolled' | translate" (action)="toggleEnrolled(!showOnlyEnrolled)" | ||||
|                     iconAction="toggle" [toggle]="showOnlyEnrolled"></core-context-menu-item>    | ||||
|             </core-context-menu> | ||||
|  | ||||
| @ -35,7 +35,6 @@ export class CoreCoursesListPage implements OnInit, OnDestroy { | ||||
|     downloadAllCoursesEnabled = false; | ||||
| 
 | ||||
|     searchEnabled = false; | ||||
|     myCoursesEnabled = true; | ||||
|     searchMode = false; | ||||
|     searchCanLoadMore = false; | ||||
|     searchLoadMoreError = false; | ||||
| @ -84,7 +83,6 @@ export class CoreCoursesListPage implements OnInit, OnDestroy { | ||||
|             this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite(); | ||||
|             this.downloadCourseEnabled = !CoreCourses.isDownloadCourseDisabledInSite(); | ||||
|             this.downloadCoursesEnabled = !CoreCourses.isDownloadCoursesDisabledInSite(); | ||||
|             this.myCoursesEnabled = !CoreCourses.isMyCoursesDisabledInSite(); | ||||
| 
 | ||||
|             this.downloadEnabled = (this.downloadCourseEnabled || this.downloadCoursesEnabled) && this.downloadEnabled; | ||||
|             if (!this.searchEnabled) { | ||||
| @ -111,12 +109,6 @@ export class CoreCoursesListPage implements OnInit, OnDestroy { | ||||
| 
 | ||||
|         this.mode = CoreNavigator.getRouteParam<CoreCoursesListMode>('mode') || this.mode; | ||||
| 
 | ||||
|         this.myCoursesEnabled = !CoreCourses.isMyCoursesDisabledInSite(); | ||||
|         if (this.mode == 'my' && !this.myCoursesEnabled) { | ||||
|             this.mode = 'all'; | ||||
|             this.showOnlyEnrolled = false; | ||||
|         } | ||||
| 
 | ||||
|         if (this.mode == 'search') { | ||||
|             this.searchMode = true; | ||||
|         } | ||||
| @ -140,8 +132,10 @@ export class CoreCoursesListPage implements OnInit, OnDestroy { | ||||
|      */ | ||||
|     protected async fetchCourses(): Promise<void> { | ||||
|         try { | ||||
|             if (this.searchMode && this.searchText) { | ||||
|                 await this.search(this.searchText); | ||||
|             if (this.searchMode) { | ||||
|                 if (this.searchText) { | ||||
|                     await this.search(this.searchText); | ||||
|                 } | ||||
|             } else if (this.showOnlyEnrolled) { | ||||
|                 await this.loadMyCourses(); | ||||
|             } else { | ||||
|  | ||||
| @ -107,7 +107,7 @@ export class CoreCoursesDashboardProvider { | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Check if Site Home is disabled in a certain site. | ||||
|      * Check if Dashboard is disabled in a certain site. | ||||
|      * | ||||
|      * @param site Site. If not defined, use current site. | ||||
|      * @return Whether it's disabled. | ||||
|  | ||||
| @ -194,11 +194,11 @@ export class CoreSiteHomeIndexPage implements OnInit, OnDestroy { | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Convenience function to switch download enabled. | ||||
|      * Switch download enabled. | ||||
|      * | ||||
|      * @param enable If enable or disable. | ||||
|      */ | ||||
|     protected switchDownload(enable: boolean): void { | ||||
|     switchDownload(enable: boolean): void { | ||||
|         this.downloadEnabled = | ||||
|             CoreCourses.setCourseDownloadOptionsEnabled(enable); | ||||
|     } | ||||
|  | ||||
| @ -169,20 +169,12 @@ export class CoreSiteHomeProvider { | ||||
|                     // Get number of news items to show.
 | ||||
|                     add = !!CoreSites.getCurrentSite()?.getStoredConfig('newsitems'); | ||||
|                     break; | ||||
|                 case FrontPageItemNames['LIST_OF_CATEGORIES']: | ||||
|                 case FrontPageItemNames['COMBO_LIST']: | ||||
|                     itemNumber = FrontPageItemNames['LIST_OF_CATEGORIES']; // Do not break here.
 | ||||
|                 case FrontPageItemNames['LIST_OF_CATEGORIES']: | ||||
|                 case FrontPageItemNames['LIST_OF_COURSE']: | ||||
|                     add = true; | ||||
|                     if (itemNumber == FrontPageItemNames['COMBO_LIST']) { | ||||
|                         itemNumber = FrontPageItemNames['LIST_OF_CATEGORIES']; | ||||
|                     } | ||||
|                     break; | ||||
|                 case FrontPageItemNames['ENROLLED_COURSES']: | ||||
|                     if (!CoreCourses.isMyCoursesDisabledInSite()) { | ||||
|                         const courses = await CoreCourses.getUserCourses(); | ||||
| 
 | ||||
|                         add = courses.length > 0; | ||||
|                     } | ||||
|                     add = true; | ||||
|                     break; | ||||
|                 case FrontPageItemNames['COURSE_SEARCH_BOX']: | ||||
|                     add = !CoreCourses.isSearchCoursesDisabledInSite(); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user