Merge pull request #1812 from dpalou/MOBILE-2919
MOBILE-2919 message: Fix error when auto-open discussionmain
commit
3b4d3fd3b6
|
@ -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;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue