diff --git a/packages/ringcentral-integration/modules/ConversationLogger/index.js b/packages/ringcentral-integration/modules/ConversationLogger/index.js index 07d62a7432..1ff8162c79 100644 --- a/packages/ringcentral-integration/modules/ConversationLogger/index.js +++ b/packages/ringcentral-integration/modules/ConversationLogger/index.js @@ -70,14 +70,14 @@ export default class ConversationLogger extends LoggerBase { actionTypes, identityFunction: conversationLogIdentityFunction, }); - this._auth = this::ensureExist(auth, 'auth'); - this._contactMatcher = this::ensureExist(contactMatcher, 'contactMatcher'); - this._conversationMatcher = this::ensureExist(conversationMatcher, 'conversationMatcher'); - this._dateTimeFormat = this::ensureExist(dateTimeFormat, 'dateTimeFormat'); - this._extensionInfo = this::ensureExist(extensionInfo, 'extensionInfo'); - this._messageStore = this::ensureExist(messageStore, 'messageStore'); - this._rolesAndPermissions = this::ensureExist(rolesAndPermissions, 'rolesAndPermissions'); - this._storage = this::ensureExist(storage, 'storage'); + this._auth = this:: ensureExist(auth, 'auth'); + this._contactMatcher = this:: ensureExist(contactMatcher, 'contactMatcher'); + this._conversationMatcher = this:: ensureExist(conversationMatcher, 'conversationMatcher'); + this._dateTimeFormat = this:: ensureExist(dateTimeFormat, 'dateTimeFormat'); + this._extensionInfo = this:: ensureExist(extensionInfo, 'extensionInfo'); + this._messageStore = this:: ensureExist(messageStore, 'messageStore'); + this._rolesAndPermissions = this:: ensureExist(rolesAndPermissions, 'rolesAndPermissions'); + this._storage = this:: ensureExist(storage, 'storage'); this._tabManager = tabManager; this._isLoggedContact = isLoggedContact; this._formatDateTime = formatDateTime; @@ -432,6 +432,9 @@ export default class ConversationLogger extends LoggerBase { return this._selectors.conversationLogIds(); } getConversationLogId(message) { + if (!message) { + return; + } const { conversationId } = message; const date = this._formatDateTime({ type: 'date', diff --git a/packages/ringcentral-widgets/components/ConversationPanel/index.js b/packages/ringcentral-widgets/components/ConversationPanel/index.js index d279c4d7c7..c57a93bceb 100644 --- a/packages/ringcentral-widgets/components/ConversationPanel/index.js +++ b/packages/ringcentral-widgets/components/ConversationPanel/index.js @@ -102,10 +102,17 @@ class ConversationPanel extends Component { const { correspondentMatches, lastMatchedCorrespondentEntity, + conversationMatches } = nextProps.conversation; - if (lastMatchedCorrespondentEntity) { - const index = correspondentMatches.findIndex(contact => ( - contact.id === lastMatchedCorrespondentEntity.id + let index = null; + const correspondentMatchId = ( + lastMatchedCorrespondentEntity && + lastMatchedCorrespondentEntity.id) || + (conversationMatches[0] && + conversationMatches[0].id); + if (correspondentMatchId) { + index = correspondentMatches.findIndex(contact => ( + contact.id === correspondentMatchId )); if (index > -1) return index; } @@ -317,7 +324,7 @@ ConversationPanel.propTypes = { loadConversation: PropTypes.func, renderExtraButton: PropTypes.func, loadingNextPage: PropTypes.bool, - inputExpandable:PropTypes.bool, + inputExpandable: PropTypes.bool, }; ConversationPanel.defaultProps = { disableLinks: false,