Add ability to invite contact by phone number
This commit is contained in:
parent
1b6c5a7141
commit
ab5627212d
|
@ -271,6 +271,21 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
|
||||||
|
|
||||||
_parseQueryResults: (?Array<Object>) => Array<Object>;
|
_parseQueryResults: (?Array<Object>) => Array<Object>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the avatar component for a user.
|
||||||
|
*
|
||||||
|
* @param {Object} user - The user
|
||||||
|
* @param {string} className - The CSS class for the avatar component
|
||||||
|
* @private
|
||||||
|
* @returns {ReactElement}
|
||||||
|
*/
|
||||||
|
_getAvatar(user, className = 'avatar-small') {
|
||||||
|
return (<Avatar
|
||||||
|
className = { className }
|
||||||
|
status = { user.status }
|
||||||
|
url = { user.avatar } />);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes results from requesting available numbers and people by munging
|
* Processes results from requesting available numbers and people by munging
|
||||||
* each result into a format {@code MultiSelectAutocomplete} can use for
|
* each result into a format {@code MultiSelectAutocomplete} can use for
|
||||||
|
@ -283,24 +298,40 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
|
||||||
* search autocomplete.
|
* search autocomplete.
|
||||||
*/
|
*/
|
||||||
_parseQueryResults(response = []) {
|
_parseQueryResults(response = []) {
|
||||||
const { t } = this.props;
|
const { t, _dialOutEnabled } = this.props;
|
||||||
const users = response.filter(item => item.type !== 'phone');
|
const users = response.filter(item => item.type !== 'phone');
|
||||||
const userDisplayItems = users.map(user => {
|
const userDisplayItems = [];
|
||||||
return {
|
|
||||||
content: user.name,
|
users.forEach(user => {
|
||||||
elemBefore: <Avatar
|
const { name, phone } = user;
|
||||||
className = { 'avatar-small' }
|
const tagAvatar = this._getAvatar(user, 'avatar-xsmall');
|
||||||
status = { user.status }
|
const elemAvatar = this._getAvatar(user);
|
||||||
url = { user.avatar } />,
|
|
||||||
|
userDisplayItems.push({
|
||||||
|
content: name,
|
||||||
|
elemBefore: elemAvatar,
|
||||||
item: user,
|
item: user,
|
||||||
tag: {
|
tag: {
|
||||||
elemBefore: <Avatar
|
elemBefore: tagAvatar
|
||||||
className = { 'avatar-xsmall' }
|
|
||||||
status = { user.status }
|
|
||||||
url = { user.avatar } />
|
|
||||||
},
|
},
|
||||||
value: user.id || user.user_id
|
value: user.id || user.user_id
|
||||||
};
|
});
|
||||||
|
|
||||||
|
if (phone && _dialOutEnabled) {
|
||||||
|
userDisplayItems.push({
|
||||||
|
filterValues: [ name, phone ],
|
||||||
|
content: `${phone} (${name})`,
|
||||||
|
elemBefore: elemAvatar,
|
||||||
|
item: {
|
||||||
|
type: 'phone',
|
||||||
|
number: phone
|
||||||
|
},
|
||||||
|
tag: {
|
||||||
|
elemBefore: tagAvatar
|
||||||
|
},
|
||||||
|
value: phone
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const numbers = response.filter(item => item.type === 'phone');
|
const numbers = response.filter(item => item.type === 'phone');
|
||||||
|
|
Loading…
Reference in New Issue