MOBILE-2915 messages: Fix error if push clicked in discs view
This commit is contained in:
		
							parent
							
								
									489094598a
								
							
						
					
					
						commit
						879792ac11
					
				@ -92,8 +92,8 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
 | 
				
			|||||||
                    discussion.unread = false;
 | 
					                    discussion.unread = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // Conversations changed, invalidate them and refresh unread counts.
 | 
					                    // Conversations changed, invalidate them and refresh unread counts.
 | 
				
			||||||
                    this.messagesProvider.invalidateConversations();
 | 
					                    this.messagesProvider.invalidateConversations(this.siteId);
 | 
				
			||||||
                    this.messagesProvider.refreshUnreadConversationCounts();
 | 
					                    this.messagesProvider.refreshUnreadConversationCounts(this.siteId);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }, this.siteId);
 | 
					        }, this.siteId);
 | 
				
			||||||
@ -145,10 +145,10 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    refreshData(refresher?: any, refreshUnreadCounts: boolean = true): Promise<any> {
 | 
					    refreshData(refresher?: any, refreshUnreadCounts: boolean = true): Promise<any> {
 | 
				
			||||||
        const promises = [];
 | 
					        const promises = [];
 | 
				
			||||||
        promises.push(this.messagesProvider.invalidateDiscussionsCache());
 | 
					        promises.push(this.messagesProvider.invalidateDiscussionsCache(this.siteId));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (refreshUnreadCounts) {
 | 
					        if (refreshUnreadCounts) {
 | 
				
			||||||
            promises.push(this.messagesProvider.invalidateUnreadConversationCounts());
 | 
					            promises.push(this.messagesProvider.invalidateUnreadConversationCounts(this.siteId));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return this.utils.allPromises(promises).finally(() => {
 | 
					        return this.utils.allPromises(promises).finally(() => {
 | 
				
			||||||
@ -171,7 +171,7 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        const promises = [];
 | 
					        const promises = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        promises.push(this.messagesProvider.getDiscussions().then((discussions) => {
 | 
					        promises.push(this.messagesProvider.getDiscussions(this.siteId).then((discussions) => {
 | 
				
			||||||
            // Convert to an array for sorting.
 | 
					            // Convert to an array for sorting.
 | 
				
			||||||
            const discussionsSorted = [];
 | 
					            const discussionsSorted = [];
 | 
				
			||||||
            for (const userId in discussions) {
 | 
					            for (const userId in discussions) {
 | 
				
			||||||
@ -184,7 +184,7 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
        }));
 | 
					        }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        promises.push(this.messagesProvider.getUnreadConversationCounts());
 | 
					        promises.push(this.messagesProvider.getUnreadConversationCounts(this.siteId));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return Promise.all(promises).catch((error) => {
 | 
					        return Promise.all(promises).catch((error) => {
 | 
				
			||||||
            this.domUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingdiscussions', true);
 | 
					            this.domUtils.showErrorModalDefault(error, 'addon.messages.errorwhileretrievingdiscussions', true);
 | 
				
			||||||
@ -216,7 +216,7 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
 | 
				
			|||||||
        this.loaded = false;
 | 
					        this.loaded = false;
 | 
				
			||||||
        this.loadingMessage = this.search.loading;
 | 
					        this.loadingMessage = this.search.loading;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return this.messagesProvider.searchMessages(query).then((searchResults) => {
 | 
					        return this.messagesProvider.searchMessages(query, undefined, undefined, undefined, this.siteId).then((searchResults) => {
 | 
				
			||||||
            this.search.showResults = true;
 | 
					            this.search.showResults = true;
 | 
				
			||||||
            this.search.results = searchResults.messages;
 | 
					            this.search.results = searchResults.messages;
 | 
				
			||||||
        }).catch((error) => {
 | 
					        }).catch((error) => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user