Skip to content

Commit

Permalink
[api] do not create a request history entry for each maintenance_inci…
Browse files Browse the repository at this point in the history
…dent action on accept
  • Loading branch information
adrianschroeter committed Mar 27, 2012
1 parent 9b0aa8e commit 353f697
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/api/app/controllers/request_controller.rb
Expand Up @@ -1399,6 +1399,7 @@ def command_changestate
check_for_patchinfo = false
# all maintenance_incident actions go into the same incident project
incident_project = nil
store_request=false
req.each_action do |action|
if action.value("type") == "maintenance_incident"
tprj = DbProject.get_by_name action.target.project
Expand All @@ -1423,9 +1424,9 @@ def command_changestate
return
end
action.target.set_attribute("project", incident_project.name)
store_request=true
end
end
req.save
elsif action.value("type") == "maintenance_release"
if params[:cmd] == "changestate" and params[:newstate] == "revoked"
# unlock incident project in the soft way
Expand All @@ -1440,6 +1441,7 @@ def command_changestate
end
# job done by changing target
if params[:cmd] == "setincident"
req.save
render_ok
return
end
Expand Down Expand Up @@ -1616,7 +1618,7 @@ def command_changestate

# update action with real target project
action.target.set_attribute("project", incident_project.name)
req.save
store_request=true

elsif action.value("type") == "maintenance_release"
pkg = DbPackage.get_by_project_and_name(action.source.project, action.source.package)
Expand Down Expand Up @@ -1699,6 +1701,9 @@ def command_changestate
end
end

# maintenance_incident request are modifying the request during accept
req.save if store_request
pass_to_backend path
end
end

0 comments on commit 353f697

Please sign in to comment.