Skip to content

Commit

Permalink
replace getEveryOneGroups with more proper getDefaultGroups
Browse files Browse the repository at this point in the history
  • Loading branch information
offtherailz committed Oct 3, 2016
1 parent 93fd552 commit 9170b2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions web/client/components/manager/users/UserGroups.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const UserCard = React.createClass({
return index >= 0 ? this.props.groups[index] : null;
}).filter(group => group));
},
getEveryOneGroups() {
getDefaultGroups() {
return this.props.groups.filter((group) => group.groupName === "everyone");
},
getOptions() {
Expand All @@ -55,7 +55,7 @@ const UserCard = React.createClass({
isLoading={this.props.groups.length === 0 }
name="user-groups-selector"
multi={true}
value={ (this.props.user && this.props.user.groups ? this.props.user.groups : this.getEveryOneGroups() ).map(group => group.id) }
value={ (this.props.user && this.props.user.groups ? this.props.user.groups : this.getDefaultGroups() ).map(group => group.id) }
options={this.getOptions()}
onChange={this.onChange}
/>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ describe("Test UserGroups Component", () => {
expect(comp.getOptions()).toExist();
expect(comp.getOptions().length).toBe(groups.length);

expect(comp.getEveryOneGroups()).toExist();
expect(comp.getEveryOneGroups().length).toBe(1);
expect(comp.getEveryOneGroups()[0].groupName).toBe("everyone");
expect(comp.getDefaultGroups()).toExist();
expect(comp.getDefaultGroups().length).toBe(1);
expect(comp.getDefaultGroups()[0].groupName).toBe("everyone");
});
});

0 comments on commit 9170b2e

Please sign in to comment.