Merge pull request #1546 from dpalou/MOBILE-2641

MOBILE-2641 resource: Fix icons in sites older than 3.1
main
Juan Leyva 2018-10-03 12:14:13 +02:00 committed by GitHub
commit 86501d3c4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -129,18 +129,20 @@ export class AddonModResourceModuleHandler implements CoreCourseModuleHandler {
handlerData.buttons[0].hidden = hideOpenButton; handlerData.buttons[0].hidden = hideOpenButton;
})); }));
// Get the resource data. if (this.resourceProvider.isGetResourceWSAvailable()) {
promises.push(this.resourceProvider.getResourceData(courseId, module.id).then((info) => { // Get the resource data.
resourceInfo = info; promises.push(this.resourceProvider.getResourceData(courseId, module.id).then((info) => {
})); resourceInfo = info;
}));
}
return Promise.all(promises).then(() => { return Promise.all(promises).then(() => {
const files = module.contents && module.contents.length ? module.contents : resourceInfo.contentfiles, const files = module.contents && module.contents.length ? module.contents : resourceInfo && resourceInfo.contentfiles,
resourceData = { resourceData = {
icon: '', icon: '',
extra: '' extra: ''
}, },
options = this.textUtils.unserialize(resourceInfo.displayoptions), options = (resourceInfo && this.textUtils.unserialize(resourceInfo.displayoptions)) || {},
extra = []; extra = [];
if (files && files.length) { if (files && files.length) {