Merge pull request #1421 from dpalou/MOBILE-2512

Mobile 2512
main
Juan Leyva 2018-07-24 12:11:25 +02:00 committed by GitHub
commit 5841425b6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 1 deletions

View File

@ -363,7 +363,9 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH
});
}).then(() => {
// Prefetch user profiles.
return this.userProvider.prefetchProfiles(userIds, courseId, siteId);
return this.userProvider.prefetchProfiles(userIds, courseId, siteId).catch(() => {
// Ignore errors.
});
});
}
}

View File

@ -1114,6 +1114,11 @@ export class CoreCourseHelperProvider {
return Promise.resolve();
}
if (section.hiddenbynumsections) {
// Hidden section.
return Promise.resolve();
}
section.isDownloading = true;
// Validate the section needs to be downloaded and calculate amount of modules that need to be downloaded.

View File

@ -953,6 +953,11 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate {
* @return {Promise<boolean>} Promise resolved with true if downloadable, false otherwise.
*/
isModuleDownloadable(module: any, courseId: number): Promise<boolean> {
if (module.uservisible === false) {
// Module isn't visible by the user, cannot be downloaded.
return Promise.resolve(false);
}
const handler = this.getPrefetchHandlerFor(module);
if (handler) {

View File

@ -383,6 +383,10 @@ export class CoreUserProvider {
promises = [];
userIds.forEach((userId) => {
if (userId === null) {
return;
}
userId = Number(userId); // Make sure it's a number.
// Prevent repeats and errors.