fix issue with new chat session opened

This commit is contained in:
Anton Georgiev 2017-04-07 11:00:44 -04:00
parent e3f66da499
commit d9592aba04

View File

@ -124,13 +124,14 @@ class MessageList extends Component {
// console.log('hasNewUnreadMessages=' + hasNewUnreadMessages);
// check if the messages include <user has left the meeting>
const lastMessageId = nextProps.messages[nextProps.messages.length - 1].id;
const userLeftIsDisplayed = lastMessageId.includes('partner-disconnected');
const lastMessage = nextProps.messages[nextProps.messages.length - 1];
if (lastMessage) {
const userLeftIsDisplayed = lastMessage.id.includes('partner-disconnected');
if (partnerIsLoggedOut && userLeftIsDisplayed) return false; // update leads to endless loop
}
if (switchingCorrespondent || hasNewUnreadMessages) return true;
if (partnerIsLoggedOut && userLeftIsDisplayed) return false; // update leads to endless loop
return true;
}