Skip to content

Commit d81004f

Browse files
committed
MOBILE-2915 messages: Fix error if push clicked in convs view
1 parent ac71d3f commit d81004f

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/addon/messages/pages/group-conversations/group-conversations.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
141141
conversation.unreadcount = 0;
142142

143143
// Conversations changed, invalidate them and refresh unread counts.
144-
this.messagesProvider.invalidateConversations();
145-
this.messagesProvider.refreshUnreadConversationCounts();
144+
this.messagesProvider.invalidateConversations(this.siteId);
145+
this.messagesProvider.refreshUnreadConversationCounts(this.siteId);
146146
}
147147
}
148148
}, this.siteId);
@@ -251,7 +251,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
251251
const promises = [];
252252

253253
promises.push(this.fetchConversationCounts());
254-
promises.push(this.messagesProvider.getContactRequestsCount()); // View updated by the event observer.
254+
promises.push(this.messagesProvider.getContactRequestsCount(this.siteId)); // View updated by the event observer.
255255

256256
return Promise.all(promises).then(() => {
257257
if (typeof this.favourites.expanded == 'undefined') {
@@ -323,7 +323,8 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
323323

324324
promises.push(this.fetchConversationCounts());
325325
if (refreshUnreadCounts) {
326-
promises.push(this.messagesProvider.refreshUnreadConversationCounts()); // View updated by the event observer.
326+
// View updated by event observer.
327+
promises.push(this.messagesProvider.refreshUnreadConversationCounts(this.siteId));
327328
}
328329

329330
return Promise.all(promises);
@@ -347,10 +348,10 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
347348
offlineMessages;
348349

349350
// Get the conversations and, if needed, the offline messages. Always try to get the latest data.
350-
promises.push(this.messagesProvider.invalidateConversations().catch(() => {
351+
promises.push(this.messagesProvider.invalidateConversations(this.siteId).catch(() => {
351352
// Shouldn't happen.
352353
}).then(() => {
353-
return this.messagesProvider.getConversations(option.type, option.favourites, limitFrom);
354+
return this.messagesProvider.getConversations(option.type, option.favourites, limitFrom, this.siteId);
354355
}).then((result) => {
355356
data = result;
356357
}));
@@ -362,7 +363,8 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
362363

363364
promises.push(this.fetchConversationCounts());
364365
if (refreshUnreadCounts) {
365-
promises.push(this.messagesProvider.refreshUnreadConversationCounts()); // View updated by the event observer.
366+
// View updated by the event observer.
367+
promises.push(this.messagesProvider.refreshUnreadConversationCounts(this.siteId));
366368
}
367369
}
368370

@@ -392,10 +394,10 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
392394
*/
393395
protected fetchConversationCounts(): Promise<void> {
394396
// Always try to get the latest data.
395-
return this.messagesProvider.invalidateConversationCounts().catch(() => {
397+
return this.messagesProvider.invalidateConversationCounts(this.siteId).catch(() => {
396398
// Shouldn't happen.
397399
}).then(() => {
398-
return this.messagesProvider.getConversationCounts();
400+
return this.messagesProvider.getConversationCounts(this.siteId);
399401
}).then((counts) => {
400402
this.favourites.count = counts.favourites;
401403
this.individual.count = counts.individual;
@@ -610,7 +612,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy {
610612
refreshData(refresher?: any, refreshUnreadCounts: boolean = true): Promise<any> {
611613
// Don't invalidate conversations and so, they always try to get latest data.
612614
const promises = [
613-
this.messagesProvider.invalidateContactRequestsCountCache()
615+
this.messagesProvider.invalidateContactRequestsCountCache(this.siteId)
614616
];
615617

616618
return this.utils.allPromises(promises).finally(() => {

0 commit comments

Comments
 (0)