BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
8a148793
Commit
8a148793
authored
Jul 08, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify Issue and MergeRequest UpdateServices
Now that those pesky task states are gone, these become a lot simpler.
parent
0e5fbb29
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
10 deletions
+4
-10
update_service.rb
app/services/issues/update_service.rb
+2
-4
update_service.rb
app/services/merge_requests/update_service.rb
+2
-6
No files found.
app/services/issues/update_service.rb
View file @
8a148793
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
...
...
app/services/merge_requests/update_service.rb
View file @
8a148793
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment