Skip to content

Commit

Permalink
[api] ensure to have a default bugowner on incident creation
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Dec 5, 2011
1 parent 4462069 commit 9d66c24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/api/app/helpers/maintenance_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def create_new_maintenance_incident( maintenanceProject, baseProject = nil, requ
end
if noaccess
tprj.flags.create( :flag => 'access', :status => "disable" )
tprj.flags.create( :flag => 'publish', :status => "disable" )
end
# take over roles from maintenance project
maintenanceProject.project_user_role_relationships.each do |r|
Expand All @@ -48,6 +49,12 @@ def create_new_maintenance_incident( maintenanceProject, baseProject = nil, requ
:db_project => tprj
)
end
# set default bugowner if missing
bugowner = Role.get_by_title("bugowner")
unless tprj.project_user_role_relationships.find :first, :conditions => ["role_id = ?", bugowner], :include => :role
tprj.add_user( @http_user, bugowner )
end
# and write it
tprj.set_project_type "maintenance_incident"
tprj.store
mi.db_project_id = tprj.id
Expand Down
1 change: 1 addition & 0 deletions src/api/test/functional/maintenance_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ def test_create_maintenance_incident
assert_tag( :parent => {:tag => "build"}, :tag => "disable", :content => nil )
assert_no_tag( :parent => {:tag => "access"}, :tag => "disable", :content => nil )
assert_tag( :attributes => {:role => "maintainer", :userid => "maintenance_coord"}, :tag => "person", :content => nil )
assert_tag( :attributes => {:role => "bugowner", :userid => "maintenance_coord"}, :tag => "person", :content => nil )

# create a maintenance incident under embargo
post "/source/Temp:Maintenance?cmd=createmaintenanceincident&noaccess=1", nil
Expand Down

0 comments on commit 9d66c24

Please sign in to comment.