Merge pull request #1812 from dpalou/MOBILE-2919

MOBILE-2919 message: Fix error when auto-open discussion
main
Juan Leyva 2019-03-15 09:49:41 +01:00 committed by GitHub
commit 3b4d3fd3b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.
this.newMessagesObserver = eventsProvider.on(AddonMessagesProvider.NEW_MESSAGE_EVENT, (data) => {
if (data.userId) {
if (data.userId && this.discussions) {
const discussion = this.discussions.find((disc) => {
return disc.message.user == data.userId;
});
@ -82,7 +82,7 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
// Update discussions when a message is read.
this.readChangedObserver = eventsProvider.on(AddonMessagesProvider.READ_CHANGED_EVENT, (data) => {
if (data.userId) {
if (data.userId && this.discussions) {
const discussion = this.discussions.find((disc) => {
return disc.message.user == data.userId;
});