MOBILE-2734 messages: Fix empty header when conversation doesn't exist
parent
f8addeb408
commit
f6145bfac6
|
@ -205,7 +205,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
|
||||||
// Synchronize messages if needed.
|
// Synchronize messages if needed.
|
||||||
return this.messagesSync.syncDiscussion(this.conversationId, this.userId).catch(() => {
|
return this.messagesSync.syncDiscussion(this.conversationId, this.userId).catch(() => {
|
||||||
// Ignore errors.
|
// Ignore errors.
|
||||||
}).then((warnings) => {
|
}).then((warnings): Promise<any> => {
|
||||||
if (warnings && warnings[0]) {
|
if (warnings && warnings[0]) {
|
||||||
this.domUtils.showErrorModal(warnings[0]);
|
this.domUtils.showErrorModal(warnings[0]);
|
||||||
}
|
}
|
||||||
|
@ -213,22 +213,26 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
|
||||||
if (this.groupMessagingEnabled) {
|
if (this.groupMessagingEnabled) {
|
||||||
// Get the conversation ID if it exists and we don't have it yet.
|
// Get the conversation ID if it exists and we don't have it yet.
|
||||||
return this.getConversation(this.conversationId, this.userId).then((exists) => {
|
return this.getConversation(this.conversationId, this.userId).then((exists) => {
|
||||||
|
const promises = [];
|
||||||
|
|
||||||
if (exists) {
|
if (exists) {
|
||||||
// Fetch the messages for the first time.
|
// Fetch the messages for the first time.
|
||||||
return this.fetchMessages();
|
promises.push(this.fetchMessages());
|
||||||
}
|
|
||||||
}).then(() => {
|
|
||||||
let promise;
|
|
||||||
if (this.userId) {
|
|
||||||
promise = this.messagesProvider.getMemberInfo(this.userId);
|
|
||||||
} else {
|
|
||||||
// Group conversation.
|
|
||||||
promise = Promise.resolve(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return promise.then((member) => {
|
if (this.userId) {
|
||||||
|
promises.push(this.messagesProvider.getMemberInfo(this.userId).then((member) => {
|
||||||
this.otherMember = member;
|
this.otherMember = member;
|
||||||
});
|
if (!exists && member) {
|
||||||
|
this.conversationImage = member.profileimageurl;
|
||||||
|
this.title = member.fullname;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
this.otherMember = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.all(promises);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.otherMember = null;
|
this.otherMember = null;
|
||||||
|
|
Loading…
Reference in New Issue