Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
ui: fixed team creation for standard user
Browse files Browse the repository at this point in the history
When standard user, the UI was sending a parameter through the request
that was supposed to be sent only by admin user. This was preventing
standard users from creating teams.

Signed-off-by: Vítor Avelino <[email protected]>
  • Loading branch information
Vítor Avelino authored and mssola committed Nov 28, 2018
1 parent 41138ee commit 3591e04
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/assets/javascripts/modules/teams/components/new-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@
methods: {
onSubmit() {
TeamsService.save(this.team).then((response) => {
const params = { ...this.team };
if (!this.isAdmin) {
delete params.owner_id;
}
TeamsService.save(params).then((response) => {
const team = response.data;
this.toggleForm();
Expand Down
19 changes: 19 additions & 0 deletions spec/features/teams_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,25 @@

expect(page).not_to have_css("#team_owner_id")
end

it "creates a team" do
toggle_new_team_form
fill_in "Name", with: "valid-team2"

click_button "Add"

expect(page).to have_content("Team 'valid-team2' was created successfully")
expect(page).to have_link("valid-team2")
end

context "permission disabled" do
it "doesn't see link to create team" do
APP_CONFIG["user_permission"]["create_team"]["enabled"] = false
visit teams_path

expect(page).not_to have_content("Create new team")
end
end
end
end

Expand Down

0 comments on commit 3591e04

Please sign in to comment.