blob: 0787bf8d807e2d4ff447aed6314efa84193a0606 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import FilteredUserList from './filtered_user_list.jsx';
import TeamMembersDropdown from './team_members_dropdown.jsx';
import UserStore from '../stores/user_store.jsx';
export default class MemberListTeam extends React.Component {
constructor(props) {
super(props);
this.getUsers = this.getUsers.bind(this);
this.onChange = this.onChange.bind(this);
this.state = {
users: this.getUsers()
};
}
componentDidMount() {
UserStore.addChangeListener(this.onChange);
}
componentWillUnmount() {
UserStore.removeChangeListener(this.onChange);
}
getUsers() {
const profiles = UserStore.getProfiles();
const users = [];
for (const id of Object.keys(profiles)) {
users.push(profiles[id]);
}
users.sort((a, b) => a.username.localeCompare(b.username));
return users;
}
onChange() {
this.setState({
users: this.getUsers()
});
}
render() {
return (
<FilteredUserList
users={this.state.users}
actions={[TeamMembersDropdown]}
/>
);
}
}
|