1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 07:01:12 +00:00

enable show contact email when search user (#4641)

* enable show contact email when search user

* [user-select] added new user option with email shown

Co-authored-by: lian <lian@seafile.com>
Co-authored-by: llj <lingjun.li1@gmail.com>
This commit is contained in:
lian
2020-08-14 14:45:44 +08:00
committed by GitHub
parent ef95810d4e
commit 12b200f3e1
6 changed files with 28 additions and 5 deletions

View File

@@ -2,10 +2,12 @@ import React from 'react';
import PropTypes from 'prop-types';
import AsyncSelect from 'react-select/lib/Async';
import { seafileAPI } from '../utils/seafile-api.js';
import { gettext } from '../utils/constants';
import { gettext, enableShowContactEmailWhenSearchUser } from '../utils/constants';
import { Utils } from '../utils/utils.js';
import toaster from './toast';
import '../css/user-select.css';
const propTypes = {
placeholder: PropTypes.string.isRequired,
onSelectChange: PropTypes.func.isRequired,
@@ -42,10 +44,19 @@ class UserSelect extends React.Component {
obj.value = item.name;
obj.email = item.email;
obj.label =
<React.Fragment>
<img src={item.avatar_url} className="select-module select-module-icon avatar" alt=""/>
<span className='select-module select-module-name'>{item.name}</span>
</React.Fragment>;
enableShowContactEmailWhenSearchUser ? (
<div className="d-flex">
<img src={item.avatar_url} className="avatar" width="24" alt="" />
<div className="ml-2">
<span className="user-option-name">{item.name}</span><br />
<span className="user-option-email">{item.contact_email}</span>
</div>
</div>
) : (
<React.Fragment>
<img src={item.avatar_url} className="select-module select-module-icon avatar" alt=""/>
<span className='select-module select-module-name'>{item.name}</span>
</React.Fragment>);
this.options.push(obj);
}
callback(this.options);