Skip to content

Commit

Permalink
Assign manager group via callback
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidKang authored and Moises Deniz Aleman committed Nov 19, 2018
1 parent 73aba80 commit 619b365
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def create

staging_project_name = "#{@staging_workflow.project}:Staging:#{params[:staging_project_name]}"
staging_project = @staging_workflow.staging_projects.build(name: staging_project_name)
staging_project.assign_managers_group(@staging_workflow.managers_group)

if staging_project.valid? && staging_project.store
flash[:success] = "Staging project with name = \"#{staging_project}\" was successfully created"
Expand Down
5 changes: 5 additions & 0 deletions src/api/app/models/staging/staging_project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class StagingProject < Project

after_save :update_staging_workflow_on_backend
after_destroy :update_staging_workflow_on_backend
before_create :add_managers_group

def staging_identifier
name[/.*:Staging:(.*)/, 1]
Expand Down Expand Up @@ -196,5 +197,9 @@ def update_staging_workflow_on_backend
staging_workflow.reload
staging_workflow.write_to_backend
end

def add_managers_group
assign_managers_group(staging_workflow.managers_group)
end
end
end
1 change: 0 additions & 1 deletion src/api/app/models/staging/workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def create_staging_projects
staging_project = parent.becomes(Staging::StagingProject)
next if staging_project.staging_workflow # if it belongs to another staging workflow skip it
staging_project.staging_workflow = self
staging_project.assign_managers_group(managers_group)
staging_project.store
end
end
Expand Down

0 comments on commit 619b365

Please sign in to comment.