Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
56a5fc0c
Commit
56a5fc0c
authored
Feb 17, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move common behavior to to IssuableBaseService
parent
372cdf4c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
34 deletions
+13
-34
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+13
-0
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+0
-17
app/services/merge_requests/update_service.rb
app/services/merge_requests/update_service.rb
+0
-17
No files found.
app/services/issuable_base_service.rb
View file @
56a5fc0c
...
...
@@ -71,6 +71,19 @@ class IssuableBaseService < BaseService
end
end
def
have_changes?
(
issuable
,
options
=
{})
valid_attrs
=
[
:title
,
:description
,
:assignee_id
,
:milestone_id
,
:target_branch
]
attrs_changed
=
valid_attrs
.
any?
do
|
attr
|
issuable
.
previous_changes
.
include?
(
attr
.
to_s
)
end
old_labels
=
options
[
:old_labels
]
labels_changed
=
old_labels
&&
issuable
.
labels
!=
old_labels
attrs_changed
||
labels_changed
end
def
handle_common_system_notes
(
issuable
,
options
=
{})
if
issuable
.
previous_changes
.
include?
(
'title'
)
create_title_change_note
(
issuable
,
issuable
.
previous_changes
[
'title'
].
first
)
...
...
app/services/issues/update_service.rb
View file @
56a5fc0c
...
...
@@ -27,22 +27,5 @@ module Issues
def
close_service
Issues
::
CloseService
end
private
def
have_changes?
(
issue
,
options
=
{})
valid_attrs
=
[
:title
,
:description
,
:assignee_id
,
:milestone_id
]
attrs_changed
=
valid_attrs
.
any?
do
|
attr
|
issue
.
previous_changes
.
include?
(
attr
.
to_s
)
end
old_labels
=
options
[
:old_labels
]
labels_changed
=
old_labels
&&
issue
.
labels
!=
old_labels
if
attrs_changed
||
labels_changed
task_service
.
mark_as_done
(
issue
,
current_user
)
end
end
end
end
app/services/merge_requests/update_service.rb
View file @
56a5fc0c
...
...
@@ -48,22 +48,5 @@ module MergeRequests
def
close_service
MergeRequests
::
CloseService
end
private
def
have_changes?
(
merge_request
,
options
=
{})
valid_attrs
=
[
:title
,
:description
,
:assignee_id
,
:milestone_id
,
:target_branch
]
attrs_changed
=
valid_attrs
.
any?
do
|
attr
|
merge_request
.
previous_changes
.
include?
(
attr
.
to_s
)
end
old_labels
=
options
[
:old_labels
]
labels_changed
=
old_labels
&&
merge_request
.
labels
!=
old_labels
if
attrs_changed
||
labels_changed
task_service
.
mark_as_done
(
merge_request
,
current_user
)
end
end
end
end
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