Commit 8a148793 authored by Robert Speicher's avatar Robert Speicher

Simplify Issue and MergeRequest UpdateServices

Now that those pesky task states are gone, these become a lot simpler.
parent 0e5fbb29
module Issues
class UpdateService < Issues::BaseService
def execute(issue)
state = params[:state_event]
case state
case params.delete(:state_event)
when 'reopen'
Issues::ReopenService.new(project, current_user, {}).execute(issue)
when 'close'
......@@ -16,7 +14,7 @@ module Issues
filter_params
old_labels = issue.labels.to_a
if params.present? && issue.update_attributes(params.except(:state_event))
if params.present? && issue.update_attributes(params)
issue.reset_events_cache
if issue.labels != old_labels
......
......@@ -11,9 +11,7 @@ module MergeRequests
params.except!(:target_project_id)
params.except!(:source_branch)
state = params[:state_event]
case state
case params.delete(:state_event)
when 'reopen'
MergeRequests::ReopenService.new(project, current_user, {}).execute(merge_request)
when 'close'
......@@ -26,9 +24,7 @@ module MergeRequests
filter_params
old_labels = merge_request.labels.to_a
if params.present? && merge_request.update_attributes(
params.except(:state_event)
)
if params.present? && merge_request.update_attributes(params)
merge_request.reset_events_cache
if merge_request.labels != old_labels
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment