summaryrefslogtreecommitdiffstats
path: root/webapp/components/admin_console/select_team_modal.jsx
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-02-01 08:57:16 +0900
committerenahum <nahumhbl@gmail.com>2017-01-31 20:57:16 -0300
commit9ba968ce3354b1a8ab307ecc4cc785bdee16f914 (patch)
tree1180a7913c326ed66191555d5a21d0643e932b8a /webapp/components/admin_console/select_team_modal.jsx
parent9369cab56c82629d505d44d572f273df1d396972 (diff)
downloadchat-9ba968ce3354b1a8ab307ecc4cc785bdee16f914.tar.gz
chat-9ba968ce3354b1a8ab307ecc4cc785bdee16f914.tar.bz2
chat-9ba968ce3354b1a8ab307ecc4cc785bdee16f914.zip
Use consistent Display Name sorting code throughout the webapp #5159 (#5213)
* Use consistent Display Name sorting code throughout the webapp #5159 * fixed broken sorting of teams and channels
Diffstat (limited to 'webapp/components/admin_console/select_team_modal.jsx')
-rw-r--r--webapp/components/admin_console/select_team_modal.jsx14
1 files changed, 4 insertions, 10 deletions
diff --git a/webapp/components/admin_console/select_team_modal.jsx b/webapp/components/admin_console/select_team_modal.jsx
index 14448d753..68e20f852 100644
--- a/webapp/components/admin_console/select_team_modal.jsx
+++ b/webapp/components/admin_console/select_team_modal.jsx
@@ -3,18 +3,17 @@
import ReactDOM from 'react-dom';
import {FormattedMessage} from 'react-intl';
-
import {Modal} from 'react-bootstrap';
-
import React from 'react';
+import {sortTeamsByDisplayName} from 'utils/utils.jsx';
+
export default class SelectTeamModal extends React.Component {
constructor(props) {
super(props);
this.doSubmit = this.doSubmit.bind(this);
this.doCancel = this.doCancel.bind(this);
- this.compare = this.compare.bind(this);
}
doSubmit(e) {
@@ -25,24 +24,19 @@ export default class SelectTeamModal extends React.Component {
this.props.onModalDismissed();
}
- compare(a, b) {
- return a.display_name.localeCompare(b.display_name);
- }
-
render() {
if (this.props.teams == null) {
return <div/>;
}
const options = [];
- const teamsArray = [];
+ let teamsArray = [];
Reflect.ownKeys(this.props.teams).forEach((key) => {
teamsArray.push(this.props.teams[key]);
});
- teamsArray.sort(this.compare);
-
+ teamsArray = teamsArray.sort(sortTeamsByDisplayName);
for (let i = 0; i < teamsArray.length; i++) {
const team = teamsArray[i];
options.push(