Merge pull request #1966 from dpalou/MOBILE-3039

Mobile 3039
main
Juan Leyva 2019-06-05 12:12:18 +02:00 committed by GitHub
commit 3de64edd24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -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;
});
}
/**

View File

@ -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,