MOBILE-3099 course: Improve module has view check

main
Pau Ferrer Ocaña 2021-12-01 12:16:33 +01:00
parent ba5697b4e7
commit a19bb744d9
2 changed files with 10 additions and 0 deletions

View File

@ -39,6 +39,7 @@ export class AddonModLabelModuleHandlerService extends CoreModuleHandlerBase imp
[CoreConstants.FEATURE_GRADE_OUTCOMES]: false,
[CoreConstants.FEATURE_BACKUP_MOODLE2]: true,
[CoreConstants.FEATURE_SHOW_DESCRIPTION]: true,
[CoreConstants.FEATURE_NO_VIEW_LINK]: true,
};
/**

View File

@ -44,6 +44,7 @@ import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins';
import { CoreCourseAutoSyncData, CoreCourseSyncProvider } from './sync';
import { CoreTagItem } from '@features/tag/services/tag';
import { CoreNavigator } from '@services/navigator';
import { CoreCourseModuleDelegate } from './module-delegate';
const ROOT_CACHE_KEY = 'mmCourse:';
@ -1058,6 +1059,14 @@ export class CoreCourseProvider {
* @return Whether the module has a view page.
*/
moduleHasView(module: CoreCourseModuleSummary | CoreCourseWSModule): boolean {
if ('modname' in module) {
// noviewlink was introduced in 3.8.5, use supports feature as a fallback.
if (module.noviewlink ||
CoreCourseModuleDelegate.supportsFeature(module.modname, CoreConstants.FEATURE_NO_VIEW_LINK, false)) {
return false;
}
}
return !!module.url;
}