MOBILE-3099 course: Improve module has view check
parent
ba5697b4e7
commit
a19bb744d9
|
@ -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,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue