forked from CIT/Vmeda.Online
		
	MOBILE-3039 forum: Fix attachments not downloaded on prefetch
This commit is contained in:
		
							parent
							
								
									f719d8e9b1
								
							
						
					
					
						commit
						a3d88eba4e
					
				| @ -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; | ||||||
|  |         }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user