MOBILE-2919 message: Fix error when auto-open discussion

main
Dani Palou 2019-03-15 08:43:45 +01:00
parent 8b2ed818fa
commit f94b1a34e7
1 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
// Update discussions when new message is received. // Update discussions when new message is received.
this.newMessagesObserver = eventsProvider.on(AddonMessagesProvider.NEW_MESSAGE_EVENT, (data) => { this.newMessagesObserver = eventsProvider.on(AddonMessagesProvider.NEW_MESSAGE_EVENT, (data) => {
if (data.userId) { if (data.userId && this.discussions) {
const discussion = this.discussions.find((disc) => { const discussion = this.discussions.find((disc) => {
return disc.message.user == data.userId; return disc.message.user == data.userId;
}); });
@ -82,7 +82,7 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
// Update discussions when a message is read. // Update discussions when a message is read.
this.readChangedObserver = eventsProvider.on(AddonMessagesProvider.READ_CHANGED_EVENT, (data) => { this.readChangedObserver = eventsProvider.on(AddonMessagesProvider.READ_CHANGED_EVENT, (data) => {
if (data.userId) { if (data.userId && this.discussions) {
const discussion = this.discussions.find((disc) => { const discussion = this.discussions.find((disc) => {
return disc.message.user == data.userId; return disc.message.user == data.userId;
}); });