From 301cc192345dc2851f07c203488239adfdb7c3bf Mon Sep 17 00:00:00 2001 From: caffffe Date: Wed, 29 Mar 2017 10:34:25 +0800 Subject: [PATCH 1/7] fix bug -- recipientheader is null --- dev-server/Phone.js | 67 +++++++++++++++++++++--- dev-server/containers/App/index.js | 3 +- src/components/RecipientHeader/index.js | 4 +- src/containers/ConversationPage/index.js | 1 + 4 files changed, 65 insertions(+), 10 deletions(-) diff --git a/dev-server/Phone.js b/dev-server/Phone.js index 3ba470f1c9..d07fc9caad 100644 --- a/dev-server/Phone.js +++ b/dev-server/Phone.js @@ -42,6 +42,7 @@ import DetailedPresence from 'ringcentral-integration/modules/DetailedPresence'; import CallLog from 'ringcentral-integration/modules/CallLog'; import CallMonitor from 'ringcentral-integration/modules/CallMonitor'; import CallHistory from 'ringcentral-integration/modules/CallHistory'; +import ContactMatcher from 'ringcentral-integration/modules/ContactMatcher'; import RouterInteraction from '../src/modules/RouterInteraction'; @@ -273,12 +274,61 @@ export default class Phone extends RcModule { return false; }); }, - formatFn: entities => entities.map(entity => ({ + // formatFn: entities => entities.map(entity => ({ + // entityType: 'contact', + // name: entity.name, + // phoneNumber: entity.ext, + // phoneType: 'extension', + // })), + formatFn: () => [{ entityType: 'contact', - name: entity.name, - phoneNumber: entity.ext, - phoneType: 'extension', - })), + name: 'bulk1', + phoneNumber: '132', + phoneType: 'home', + }, + { + entityType: 'contact', + name: 'bulk2', + phoneNumber: '222', + phoneType: 'business', + }, + { + entityType: 'contact', + name: 'bulk3', + phoneNumber: '333', + phoneType: 'home', + }, + { + entityType: 'contact', + name: 'bulk4', + phoneNumber: '555', + phoneType: 'home', + }, + { + entityType: 'contact', + name: 'bulk5', + phoneNumber: '333', + phoneType: 'home', + }, + { + entityType: 'contact', + name: 'bulk6', + phoneNumber: '333', + phoneType: 'home', + }, + { + entityType: 'contact', + name: 'bulk7', + phoneNumber: '333', + phoneType: 'home', + }, + { + entityType: 'contact', + name: 'bulk8', + phoneNumber: '333', + phoneType: 'home', + } + ], readyCheckFn: () => this.accountExtension.ready, }); this.addModule('messageSender', new MessageSender({ @@ -366,7 +416,11 @@ export default class Phone extends RcModule { contactMatcher: this.contactMatcher, getState: () => this.state.callHistory, })); - + this.addModule('contactMatcher', new ContactMatcher({ + ...options, + storage: this.storage, + getState: () => this.state.contactMatcher, + })); this._reducer = combineReducers({ accountExtension: this.accountExtension.reducer, accountInfo: this.accountInfo.reducer, @@ -409,6 +463,7 @@ export default class Phone extends RcModule { callLog: this.callLog.reducer, callMonitor: this.callMonitor.reducer, callHistory: this.callHistory.reducer, + contactMatcher: this.contactMatcher.reducer, lastAction: (state = null, action) => { console.log(action); return action; diff --git a/dev-server/containers/App/index.js b/dev-server/containers/App/index.js index 7512bcb015..c56ff5c9fc 100644 --- a/dev-server/containers/App/index.js +++ b/dev-server/containers/App/index.js @@ -195,7 +195,7 @@ export default function App({ conversation={phone.conversation} messageStore={phone.messageStore} dateTimeFormat={phone.dateTimeFormat} - // contactMatcher={phone.contactMatcher} + contactMatcher={phone.contactMatcher} /> )} /> )} /> diff --git a/src/components/RecipientHeader/index.js b/src/components/RecipientHeader/index.js index dcb61fbab1..85ebdfe764 100644 --- a/src/components/RecipientHeader/index.js +++ b/src/components/RecipientHeader/index.js @@ -30,9 +30,9 @@ function MatchedNameList(props) { return (
{ - this.props.isSelected ? + props.isSelected ? null diff --git a/src/containers/ConversationPage/index.js b/src/containers/ConversationPage/index.js index 70f505e347..305ddf688e 100644 --- a/src/containers/ConversationPage/index.js +++ b/src/containers/ConversationPage/index.js @@ -105,6 +105,7 @@ function mapStateToProps(state, props) { ), recipients: props.conversation.recipients, messages: props.conversation.messages, + contactMatcher: props.contactMatcher, }); } From f9b207d1f09606d2fa0c7ab0a1e58ac173aceb5a Mon Sep 17 00:00:00 2001 From: caffffe Date: Wed, 29 Mar 2017 10:36:38 +0800 Subject: [PATCH 2/7] fix bug -- recipientheader is null --- dev-server/Phone.js | 67 +++--------------------- src/containers/ConversationPage/index.js | 1 - 2 files changed, 6 insertions(+), 62 deletions(-) diff --git a/dev-server/Phone.js b/dev-server/Phone.js index d07fc9caad..3ba470f1c9 100644 --- a/dev-server/Phone.js +++ b/dev-server/Phone.js @@ -42,7 +42,6 @@ import DetailedPresence from 'ringcentral-integration/modules/DetailedPresence'; import CallLog from 'ringcentral-integration/modules/CallLog'; import CallMonitor from 'ringcentral-integration/modules/CallMonitor'; import CallHistory from 'ringcentral-integration/modules/CallHistory'; -import ContactMatcher from 'ringcentral-integration/modules/ContactMatcher'; import RouterInteraction from '../src/modules/RouterInteraction'; @@ -274,61 +273,12 @@ export default class Phone extends RcModule { return false; }); }, - // formatFn: entities => entities.map(entity => ({ - // entityType: 'contact', - // name: entity.name, - // phoneNumber: entity.ext, - // phoneType: 'extension', - // })), - formatFn: () => [{ + formatFn: entities => entities.map(entity => ({ entityType: 'contact', - name: 'bulk1', - phoneNumber: '132', - phoneType: 'home', - }, - { - entityType: 'contact', - name: 'bulk2', - phoneNumber: '222', - phoneType: 'business', - }, - { - entityType: 'contact', - name: 'bulk3', - phoneNumber: '333', - phoneType: 'home', - }, - { - entityType: 'contact', - name: 'bulk4', - phoneNumber: '555', - phoneType: 'home', - }, - { - entityType: 'contact', - name: 'bulk5', - phoneNumber: '333', - phoneType: 'home', - }, - { - entityType: 'contact', - name: 'bulk6', - phoneNumber: '333', - phoneType: 'home', - }, - { - entityType: 'contact', - name: 'bulk7', - phoneNumber: '333', - phoneType: 'home', - }, - { - entityType: 'contact', - name: 'bulk8', - phoneNumber: '333', - phoneType: 'home', - } - ], + name: entity.name, + phoneNumber: entity.ext, + phoneType: 'extension', + })), readyCheckFn: () => this.accountExtension.ready, }); this.addModule('messageSender', new MessageSender({ @@ -416,11 +366,7 @@ export default class Phone extends RcModule { contactMatcher: this.contactMatcher, getState: () => this.state.callHistory, })); - this.addModule('contactMatcher', new ContactMatcher({ - ...options, - storage: this.storage, - getState: () => this.state.contactMatcher, - })); + this._reducer = combineReducers({ accountExtension: this.accountExtension.reducer, accountInfo: this.accountInfo.reducer, @@ -463,7 +409,6 @@ export default class Phone extends RcModule { callLog: this.callLog.reducer, callMonitor: this.callMonitor.reducer, callHistory: this.callHistory.reducer, - contactMatcher: this.contactMatcher.reducer, lastAction: (state = null, action) => { console.log(action); return action; diff --git a/src/containers/ConversationPage/index.js b/src/containers/ConversationPage/index.js index 305ddf688e..70f505e347 100644 --- a/src/containers/ConversationPage/index.js +++ b/src/containers/ConversationPage/index.js @@ -105,7 +105,6 @@ function mapStateToProps(state, props) { ), recipients: props.conversation.recipients, messages: props.conversation.messages, - contactMatcher: props.contactMatcher, }); } From bd0733bd98b146561fc57d7f2ee8195b124088e6 Mon Sep 17 00:00:00 2001 From: caffffe Date: Wed, 29 Mar 2017 16:37:21 +0800 Subject: [PATCH 3/7] add type to recipientHeader --- dev-server/Phone.js | 9 +++++- src/components/RecipientHeader/index.js | 6 ++-- src/components/RecipientHeader/styles.scss | 2 +- src/components/RecipientsHeader/index.js | 14 +++++----- src/components/RecipientsHeader/styles.scss | 2 +- src/containers/ConversationPage/index.js | 31 +++++++++++---------- 6 files changed, 37 insertions(+), 27 deletions(-) diff --git a/dev-server/Phone.js b/dev-server/Phone.js index 3ba470f1c9..3144dfade4 100644 --- a/dev-server/Phone.js +++ b/dev-server/Phone.js @@ -43,6 +43,8 @@ import CallLog from 'ringcentral-integration/modules/CallLog'; import CallMonitor from 'ringcentral-integration/modules/CallMonitor'; import CallHistory from 'ringcentral-integration/modules/CallHistory'; +import ContactMatcher from 'ringcentral-integration/modules/ContactMatcher' + import RouterInteraction from '../src/modules/RouterInteraction'; export default class Phone extends RcModule { @@ -366,7 +368,11 @@ export default class Phone extends RcModule { contactMatcher: this.contactMatcher, getState: () => this.state.callHistory, })); - + this.addModule('contactMatcher', new ContactMatcher({ + ...options, + storage: this.storage, + getState: () => this.state.contactMatcher, + })); this._reducer = combineReducers({ accountExtension: this.accountExtension.reducer, accountInfo: this.accountInfo.reducer, @@ -409,6 +415,7 @@ export default class Phone extends RcModule { callLog: this.callLog.reducer, callMonitor: this.callMonitor.reducer, callHistory: this.callHistory.reducer, + contactMatcher: this.contactMatcher.reducer, lastAction: (state = null, action) => { console.log(action); return action; diff --git a/src/components/RecipientHeader/index.js b/src/components/RecipientHeader/index.js index 85ebdfe764..b11b32e9a5 100644 --- a/src/components/RecipientHeader/index.js +++ b/src/components/RecipientHeader/index.js @@ -100,7 +100,7 @@ class RecipientHeader extends Component { if (!hasDropdown) { return ( - {this.context.getRecipientName(recipient)} + {this.context.getRecipientInfo(recipient)} ); } @@ -111,7 +111,7 @@ class RecipientHeader extends Component { const phoneNumber = recipient.phoneNumber || recipient.extensionNumber; let matchedNames = this.context.getMatcherContactList(phoneNumber); let defaultRecipient = matchedNames.join('&'); - // if it have old data + // if it has old data let isSelected = false; if (recipient.matchedNames && recipient.matchedNames[0]) { const firstMatchedName = recipient.matchedNames[0]; @@ -160,7 +160,7 @@ RecipientHeader.propTypes = { }; RecipientHeader.contextTypes = { - getRecipientName: PropTypes.func.isRequired, + getRecipientInfo: PropTypes.func.isRequired, getMatcherContactList: PropTypes.func.isRequired, changeMatchedNames: PropTypes.func.isRequired, }; diff --git a/src/components/RecipientHeader/styles.scss b/src/components/RecipientHeader/styles.scss index 81700ebf09..903bf697d9 100644 --- a/src/components/RecipientHeader/styles.scss +++ b/src/components/RecipientHeader/styles.scss @@ -12,7 +12,7 @@ .recipient { display: block; - width: 100%; + max-width: 100%; padding: 0 2px; line-height: 25px; height: 25px; diff --git a/src/components/RecipientsHeader/index.js b/src/components/RecipientsHeader/index.js index b307de1f48..ae7a6afc87 100644 --- a/src/components/RecipientsHeader/index.js +++ b/src/components/RecipientsHeader/index.js @@ -9,13 +9,13 @@ import styles from './styles.scss'; function Recipient(props) { return ( - {props.name} + {props.info} ); } Recipient.propTypes = { - name: PropTypes.string.isRequired, + info: PropTypes.string.isRequired, onClick: PropTypes.func.isRequired, }; @@ -27,7 +27,7 @@ function RecipientList(props) { recipients.map(receiver => ( props.setDefaultRecipient( receiver.extensionNumber || receiver.phoneNumber @@ -41,7 +41,7 @@ function RecipientList(props) { } RecipientList.propTypes = { - getRecipientName: PropTypes.func.isRequired, + getRecipientInfo: PropTypes.func.isRequired, setDefaultRecipient: PropTypes.func.isRequired, className: PropTypes.string.isRequired, recipients: PropTypes.arrayOf(PropTypes.shape({ @@ -94,7 +94,7 @@ class RecipientsHeader extends Component { return (

); @@ -118,7 +118,7 @@ RecipientsHeader.propTypes = { }; RecipientsHeader.contextTypes = { - getRecipientName: PropTypes.func.isRequired, + getRecipientInfo: PropTypes.func.isRequired, changeDefaultRecipient: PropTypes.func.isRequired, }; diff --git a/src/components/RecipientsHeader/styles.scss b/src/components/RecipientsHeader/styles.scss index 0ed0b646b0..d39744e3dc 100644 --- a/src/components/RecipientsHeader/styles.scss +++ b/src/components/RecipientsHeader/styles.scss @@ -1,9 +1,9 @@ .container { + position: relative; display: inline-block; text-align: center; max-width: 250px; min-width: 100px; - position: relative; margin: 0 auto; font-family: Helvetica; font-size: 14px; diff --git a/src/containers/ConversationPage/index.js b/src/containers/ConversationPage/index.js index 70f505e347..4df86965a8 100644 --- a/src/containers/ConversationPage/index.js +++ b/src/containers/ConversationPage/index.js @@ -12,7 +12,7 @@ class ConversationPage extends Component { formatDateTime: this.props.formatDateTime, changeDefaultRecipient: this.props.changeDefaultRecipient, changeMatchedNames: this.props.changeMatchedNames, - getRecipientName: recipient => (this.getRecipientName(recipient)), + getRecipientInfo: recipient => (this.getRecipientInfo(recipient)), getMatcherContactList: this.props.getMatcherContactList, }; } @@ -25,10 +25,10 @@ class ConversationPage extends Component { this.props.unloadConversation(); } - getRecipientName(recipient) { + getRecipientInfo(recipient) { const phoneNumber = recipient.phoneNumber || recipient.extensionNumber; - if (phoneNumber && this.props.getMatcherContactName) { - const matcherName = this.props.getMatcherContactName(phoneNumber); + if (phoneNumber && this.props.getMatcherContactInfo) { + const matcherName = this.props.getMatcherContactInfo(phoneNumber); if (matcherName) { return matcherName; } @@ -73,20 +73,20 @@ ConversationPage.propTypes = { changeDefaultRecipient: PropTypes.func.isRequired, formatNumber: PropTypes.func.isRequired, formatDateTime: PropTypes.func.isRequired, - getMatcherContactName: PropTypes.func, + getMatcherContactInfo: PropTypes.func, getMatcherContactList: PropTypes.func, changeMatchedNames: PropTypes.func.isRequired, }; ConversationPage.defaultProps = { - getMatcherContactName: null, + getMatcherContactInfo: null, getMatcherContactList: () => [], }; ConversationPage.childContextTypes = { formatPhone: PropTypes.func.isRequired, formatDateTime: PropTypes.func.isRequired, - getRecipientName: PropTypes.func.isRequired, + getRecipientInfo: PropTypes.func.isRequired, changeDefaultRecipient: PropTypes.func.isRequired, changeMatchedNames: PropTypes.func.isRequired, getMatcherContactList: PropTypes.func.isRequired, @@ -109,21 +109,24 @@ function mapStateToProps(state, props) { } function mapDispatchToProps(dispatch, props) { - let getMatcherContactName; + let getMatcherContactInfo; let getMatcherContactList; if (props.contactMatcher && props.contactMatcher.ready) { getMatcherContactList = (phoneNumber) => { const matcherNames = props.contactMatcher.dataMapping[phoneNumber]; + if (matcherNames && matcherNames.length > 0) { - return matcherNames.map(matcher => matcher.name); + return matcherNames.map(matcher => + `${matcher.name}|${matcher.phoneNumbers[0].phoneType}` + ); } return []; }; - getMatcherContactName = (phoneNumber) => { - const matcherNames = getMatcherContactList(phoneNumber); - if (matcherNames && matcherNames.length > 0) { - return matcherNames.join('&'); + getMatcherContactInfo = (phoneNumber) => { + const matcherInfos = getMatcherContactList(phoneNumber); + if (matcherInfos && matcherInfos.length > 0) { + return matcherInfos.join('&'); } return null; }; @@ -144,7 +147,7 @@ function mapDispatchToProps(dispatch, props) { areaCode: props.regionSettings.areaCode, countryCode: props.regionSettings.countryCode, }), - getMatcherContactName, + getMatcherContactInfo, getMatcherContactList, }; } From 3cbebc8501379bf8ecc22089a6100672f6839c90 Mon Sep 17 00:00:00 2001 From: caffffe Date: Wed, 29 Mar 2017 16:55:31 +0800 Subject: [PATCH 4/7] change name --- dev-server/Phone.js | 2 +- src/components/RecipientHeader/index.js | 4 +-- src/components/RecipientsHeader/index.js | 14 ++++----- src/containers/ConversationPage/index.js | 40 +++++++++++++++--------- 4 files changed, 35 insertions(+), 25 deletions(-) diff --git a/dev-server/Phone.js b/dev-server/Phone.js index 3144dfade4..4a76cd4b2f 100644 --- a/dev-server/Phone.js +++ b/dev-server/Phone.js @@ -43,7 +43,7 @@ import CallLog from 'ringcentral-integration/modules/CallLog'; import CallMonitor from 'ringcentral-integration/modules/CallMonitor'; import CallHistory from 'ringcentral-integration/modules/CallHistory'; -import ContactMatcher from 'ringcentral-integration/modules/ContactMatcher' +import ContactMatcher from 'ringcentral-integration/modules/ContactMatcher'; import RouterInteraction from '../src/modules/RouterInteraction'; diff --git a/src/components/RecipientHeader/index.js b/src/components/RecipientHeader/index.js index b11b32e9a5..10323fb56a 100644 --- a/src/components/RecipientHeader/index.js +++ b/src/components/RecipientHeader/index.js @@ -100,7 +100,7 @@ class RecipientHeader extends Component { if (!hasDropdown) { return ( - {this.context.getRecipientInfo(recipient)} + {this.context.getRecipientName(recipient)} ); } @@ -160,7 +160,7 @@ RecipientHeader.propTypes = { }; RecipientHeader.contextTypes = { - getRecipientInfo: PropTypes.func.isRequired, + getRecipientName: PropTypes.func.isRequired, getMatcherContactList: PropTypes.func.isRequired, changeMatchedNames: PropTypes.func.isRequired, }; diff --git a/src/components/RecipientsHeader/index.js b/src/components/RecipientsHeader/index.js index ae7a6afc87..b307de1f48 100644 --- a/src/components/RecipientsHeader/index.js +++ b/src/components/RecipientsHeader/index.js @@ -9,13 +9,13 @@ import styles from './styles.scss'; function Recipient(props) { return ( - {props.info} + {props.name} ); } Recipient.propTypes = { - info: PropTypes.string.isRequired, + name: PropTypes.string.isRequired, onClick: PropTypes.func.isRequired, }; @@ -27,7 +27,7 @@ function RecipientList(props) { recipients.map(receiver => ( props.setDefaultRecipient( receiver.extensionNumber || receiver.phoneNumber @@ -41,7 +41,7 @@ function RecipientList(props) { } RecipientList.propTypes = { - getRecipientInfo: PropTypes.func.isRequired, + getRecipientName: PropTypes.func.isRequired, setDefaultRecipient: PropTypes.func.isRequired, className: PropTypes.string.isRequired, recipients: PropTypes.arrayOf(PropTypes.shape({ @@ -94,7 +94,7 @@ class RecipientsHeader extends Component { return (

); @@ -118,7 +118,7 @@ RecipientsHeader.propTypes = { }; RecipientsHeader.contextTypes = { - getRecipientInfo: PropTypes.func.isRequired, + getRecipientName: PropTypes.func.isRequired, changeDefaultRecipient: PropTypes.func.isRequired, }; diff --git a/src/containers/ConversationPage/index.js b/src/containers/ConversationPage/index.js index 4df86965a8..9a15293d82 100644 --- a/src/containers/ConversationPage/index.js +++ b/src/containers/ConversationPage/index.js @@ -12,7 +12,7 @@ class ConversationPage extends Component { formatDateTime: this.props.formatDateTime, changeDefaultRecipient: this.props.changeDefaultRecipient, changeMatchedNames: this.props.changeMatchedNames, - getRecipientInfo: recipient => (this.getRecipientInfo(recipient)), + getRecipientName: recipient => (this.getRecipientName(recipient)), getMatcherContactList: this.props.getMatcherContactList, }; } @@ -25,10 +25,10 @@ class ConversationPage extends Component { this.props.unloadConversation(); } - getRecipientInfo(recipient) { + getRecipientName(recipient) { const phoneNumber = recipient.phoneNumber || recipient.extensionNumber; - if (phoneNumber && this.props.getMatcherContactInfo) { - const matcherName = this.props.getMatcherContactInfo(phoneNumber); + if (phoneNumber && this.props.getMatcherContactName) { + const matcherName = this.props.getMatcherContactName(phoneNumber); if (matcherName) { return matcherName; } @@ -73,20 +73,20 @@ ConversationPage.propTypes = { changeDefaultRecipient: PropTypes.func.isRequired, formatNumber: PropTypes.func.isRequired, formatDateTime: PropTypes.func.isRequired, - getMatcherContactInfo: PropTypes.func, + getMatcherContactName: PropTypes.func, getMatcherContactList: PropTypes.func, changeMatchedNames: PropTypes.func.isRequired, }; ConversationPage.defaultProps = { - getMatcherContactInfo: null, + getMatcherContactName: null, getMatcherContactList: () => [], }; ConversationPage.childContextTypes = { formatPhone: PropTypes.func.isRequired, formatDateTime: PropTypes.func.isRequired, - getRecipientInfo: PropTypes.func.isRequired, + getRecipientName: PropTypes.func.isRequired, changeDefaultRecipient: PropTypes.func.isRequired, changeMatchedNames: PropTypes.func.isRequired, getMatcherContactList: PropTypes.func.isRequired, @@ -109,24 +109,34 @@ function mapStateToProps(state, props) { } function mapDispatchToProps(dispatch, props) { - let getMatcherContactInfo; + let getMatcherContactName; let getMatcherContactList; if (props.contactMatcher && props.contactMatcher.ready) { getMatcherContactList = (phoneNumber) => { - const matcherNames = props.contactMatcher.dataMapping[phoneNumber]; + // const matcherNames = props.contactMatcher.dataMapping[phoneNumber]; + const matcherNames = [{ + entityType: 'contact', + name: 'bulk101 contact101', + phoneNumbers: [{ phoneNumber: '123', phoneType: 'mobile' }], + }, + { + entityType: 'contact', + name: 'bulk102 contact102', + phoneNumbers: [{ phoneNumber: '456', phoneType: 'home' }], + }]; if (matcherNames && matcherNames.length > 0) { return matcherNames.map(matcher => - `${matcher.name}|${matcher.phoneNumbers[0].phoneType}` + `${matcher.name} ${matcher.phoneNumbers[0].phoneType}` ); } return []; }; - getMatcherContactInfo = (phoneNumber) => { - const matcherInfos = getMatcherContactList(phoneNumber); - if (matcherInfos && matcherInfos.length > 0) { - return matcherInfos.join('&'); + getMatcherContactName = (phoneNumber) => { + const matcherNames = getMatcherContactList(phoneNumber); + if (matcherNames && matcherNames.length > 0) { + return matcherNames.join('&'); } return null; }; @@ -147,7 +157,7 @@ function mapDispatchToProps(dispatch, props) { areaCode: props.regionSettings.areaCode, countryCode: props.regionSettings.countryCode, }), - getMatcherContactInfo, + getMatcherContactName, getMatcherContactList, }; } From 3f350128ac5ccc398b732332a368ab3212fa9bc6 Mon Sep 17 00:00:00 2001 From: caffffe Date: Wed, 29 Mar 2017 16:56:14 +0800 Subject: [PATCH 5/7] change name --- src/containers/ConversationPage/index.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/containers/ConversationPage/index.js b/src/containers/ConversationPage/index.js index 9a15293d82..f1335415e9 100644 --- a/src/containers/ConversationPage/index.js +++ b/src/containers/ConversationPage/index.js @@ -113,17 +113,7 @@ function mapDispatchToProps(dispatch, props) { let getMatcherContactList; if (props.contactMatcher && props.contactMatcher.ready) { getMatcherContactList = (phoneNumber) => { - // const matcherNames = props.contactMatcher.dataMapping[phoneNumber]; - const matcherNames = [{ - entityType: 'contact', - name: 'bulk101 contact101', - phoneNumbers: [{ phoneNumber: '123', phoneType: 'mobile' }], - }, - { - entityType: 'contact', - name: 'bulk102 contact102', - phoneNumbers: [{ phoneNumber: '456', phoneType: 'home' }], - }]; + const matcherNames = props.contactMatcher.dataMapping[phoneNumber]; if (matcherNames && matcherNames.length > 0) { return matcherNames.map(matcher => From 918928c0dfb6e8bacaff8b2fa2011ecd6f36e259 Mon Sep 17 00:00:00 2001 From: caffffe Date: Wed, 29 Mar 2017 17:30:57 +0800 Subject: [PATCH 6/7] add spaces --- src/containers/ConversationPage/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/containers/ConversationPage/index.js b/src/containers/ConversationPage/index.js index f1335415e9..3c84465924 100644 --- a/src/containers/ConversationPage/index.js +++ b/src/containers/ConversationPage/index.js @@ -117,7 +117,7 @@ function mapDispatchToProps(dispatch, props) { if (matcherNames && matcherNames.length > 0) { return matcherNames.map(matcher => - `${matcher.name} ${matcher.phoneNumbers[0].phoneType}` + `${matcher.name} ${matcher.phoneNumbers[0].phoneType}` ); } return []; From 5b0502547a7ce90f5862c91bc6580819a84fb9fc Mon Sep 17 00:00:00 2001 From: caffffe Date: Thu, 30 Mar 2017 09:02:37 +0800 Subject: [PATCH 7/7] add spaces --- src/containers/ConversationPage/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/containers/ConversationPage/index.js b/src/containers/ConversationPage/index.js index 3c84465924..f7983ef5cc 100644 --- a/src/containers/ConversationPage/index.js +++ b/src/containers/ConversationPage/index.js @@ -114,10 +114,9 @@ function mapDispatchToProps(dispatch, props) { if (props.contactMatcher && props.contactMatcher.ready) { getMatcherContactList = (phoneNumber) => { const matcherNames = props.contactMatcher.dataMapping[phoneNumber]; - if (matcherNames && matcherNames.length > 0) { return matcherNames.map(matcher => - `${matcher.name} ${matcher.phoneNumbers[0].phoneType}` + `${matcher.name}|${matcher.phoneNumbers[0].phoneType}` ); } return [];