Commit 8dde651d authored by Joram Wilander's avatar Joram Wilander Committed by Corey Hulen
Browse files

Remove user from list when selected in DM modal (#5884)

parent 2f15523f
......@@ -111,7 +111,8 @@ export default class MultiSelect extends React.Component {
}
render() {
const options = this.props.options;
const options = Object.assign([], this.props.options);
const values = this.props.values;
let numRemainingText;
if (this.props.numRemainingText) {
......@@ -142,6 +143,17 @@ export default class MultiSelect extends React.Component {
);
}
const valueMap = {};
for (let i = 0; i < values.length; i++) {
valueMap[values[i].id] = true;
}
for (let i = options.length - 1; i >= 0; i--) {
if (valueMap[options[i].id]) {
options.splice(i, 1);
}
}
if (options && options.length > this.props.perPage) {
const pageStart = this.state.page * this.props.perPage;
const pageEnd = pageStart + this.props.perPage;
......
......@@ -677,7 +677,10 @@ export default class Sidebar extends React.Component {
<li key='more'>
<a
href='#'
onClick={() => this.showMoreDirectChannelsModal()}
onClick={(e) => {
e.preventDefault();
this.showMoreDirectChannelsModal();
}}
>
<FormattedMessage
id='sidebar.moreElips'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment