From 7e649138d768283c14bf04b7529cd942a8d35951 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 4 Jun 2019 12:12:15 +0200 Subject: [PATCH 1/2] MOBILE-3039 forum: Fix attachments not downloaded on prefetch --- .../mod/forum/providers/prefetch-handler.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/addon/mod/forum/providers/prefetch-handler.ts b/src/addon/mod/forum/providers/prefetch-handler.ts index 04e3289f8..6241dce19 100644 --- a/src/addon/mod/forum/providers/prefetch-handler.ts +++ b/src/addon/mod/forum/providers/prefetch-handler.ts @@ -122,7 +122,24 @@ export class AddonModForumPrefetchHandler extends CoreCourseActivityPrefetchHand }); }); - return Promise.all(promises); + return Promise.all(promises).then((results) => { + // Each order has returned its own list of posts. Merge all the lists, preventing duplicates. + const posts = [], + postIds = {}; // To make the array unique. + + results.forEach((orderResults) => { + orderResults.forEach((orderResult) => { + orderResult.posts.forEach((post) => { + if (!postIds[post.id]) { + postIds[post.id] = true; + posts.push(post); + } + }); + }); + }); + + return posts; + }); } /** From 5f0eda12357885ad497f8142d89165161d045bbd Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 4 Jun 2019 12:53:11 +0200 Subject: [PATCH 2/2] MOBILE-3039 glossary: Fix edit offline entry --- src/addon/mod/glossary/pages/edit/edit.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/addon/mod/glossary/pages/edit/edit.ts b/src/addon/mod/glossary/pages/edit/edit.ts index 8520727b6..837b0e760 100644 --- a/src/addon/mod/glossary/pages/edit/edit.ts +++ b/src/addon/mod/glossary/pages/edit/edit.ts @@ -88,6 +88,7 @@ export class AddonModGlossaryEditPage implements OnInit { if (entry) { this.entry.concept = entry.concept || ''; this.entry.definition = entry.definition || ''; + this.entry.timecreated = entry.timecreated || 0; this.originalData = { concept: this.entry.concept,