(cherry picked from commit b001c50fdc)
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
parent
12dbcfe627
commit
72c9414993
4 changed files with 26 additions and 10 deletions
|
|
@ -276,7 +276,11 @@ export default class ChannelAddMembers extends PureComponent {
|
|||
const options = {not_in_channel_id: currentChannelId, team_id: currentTeamId, group_constrained: currentChannelGroupConstrained};
|
||||
this.setState({loading: true});
|
||||
|
||||
actions.searchProfiles(term.toLowerCase(), options).then(({data}) => {
|
||||
actions.searchProfiles(term.toLowerCase(), options).then((results) => {
|
||||
let data = [];
|
||||
if (results.data) {
|
||||
data = results.data;
|
||||
}
|
||||
this.setState({searchResults: data, loading: false});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -307,7 +307,11 @@ export default class ChannelMembers extends PureComponent {
|
|||
const options = {in_channel_id: currentChannelId};
|
||||
this.setState({loading: true});
|
||||
|
||||
actions.searchProfiles(term.toLowerCase(), options).then(({data}) => {
|
||||
actions.searchProfiles(term.toLowerCase(), options).then((results) => {
|
||||
let data = [];
|
||||
if (results.data) {
|
||||
data = results.data;
|
||||
}
|
||||
this.setState({searchResults: data, loading: false});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -279,20 +279,24 @@ export default class MoreDirectMessages extends PureComponent {
|
|||
}
|
||||
};
|
||||
|
||||
searchProfiles = (term) => {
|
||||
searchProfiles = async (term) => {
|
||||
const lowerCasedTerm = term.toLowerCase();
|
||||
const {actions, currentTeamId, restrictDirectMessage} = this.props;
|
||||
this.setState({loading: true});
|
||||
let results;
|
||||
|
||||
if (restrictDirectMessage) {
|
||||
actions.searchProfiles(lowerCasedTerm).then(({data}) => {
|
||||
this.setState({searchResults: data, loading: false});
|
||||
});
|
||||
results = await actions.searchProfiles(lowerCasedTerm);
|
||||
} else {
|
||||
actions.searchProfiles(lowerCasedTerm, {team_id: currentTeamId}).then(({data}) => {
|
||||
this.setState({searchResults: data, loading: false});
|
||||
});
|
||||
results = await actions.searchProfiles(lowerCasedTerm, {team_id: currentTeamId});
|
||||
}
|
||||
|
||||
let data = [];
|
||||
if (results.data) {
|
||||
data = results.data;
|
||||
}
|
||||
|
||||
this.setState({searchResults: data, loading: false});
|
||||
};
|
||||
|
||||
startConversation = async (selectedId) => {
|
||||
|
|
|
|||
|
|
@ -215,7 +215,11 @@ export default class SelectorScreen extends PureComponent {
|
|||
const {actions} = this.props;
|
||||
this.setState({loading: true});
|
||||
|
||||
actions.searchProfiles(term.toLowerCase()).then(({data}) => {
|
||||
actions.searchProfiles(term.toLowerCase()).then((results) => {
|
||||
let data = [];
|
||||
if (results.data) {
|
||||
data = results.data;
|
||||
}
|
||||
this.setState({searchResults: data, loading: false});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue