Skip to content
Snippets Groups Projects
Commit 08377509 authored by Yannis Barlas's avatar Yannis Barlas
Browse files

guarantee team order in team manager modal

parent b25856ac
No related branches found
No related tags found
No related merge requests found
import { find, keys } from 'lodash'
import React from 'react'
import Group from './Group'
......@@ -27,11 +28,20 @@ export class GroupList extends React.Component {
render () {
const { teams, users, update } = this.props
const self = this
const options = this.options
const groups = teams.map(function (team, i) {
const name = team.name.trim()
if (!self.options[name]) return
// TODO -- refactor
// do it like this to guarantee order of groups
const groups = keys(options).map((key, i) => {
let name
// get team of this name
const team = find(teams, (team) => {
name = team.name.trim()
return name === key
})
if (!team) return
return (
<div key={i}>
......@@ -39,7 +49,7 @@ export class GroupList extends React.Component {
team={team}
users={users}
update={update}
options={self.options[name]}
options={options[name]}
/>
<div className={styles.groupSeperator} />
</div>
......@@ -61,18 +71,3 @@ GroupList.propTypes = {
}
export default GroupList
/*
<TeamGroup
type="copyEditor"
/>
<div className={styles.groupSeperator} />
<TeamGroup
type="author"
/>
<div className={styles.groupSeperator} />
*/
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