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
7edf65d1
Unverified
Commit
7edf65d1
authored
Jun 10, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make a system comment when issue milestone changed
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
f055bad5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
note.rb
app/models/note.rb
+16
-0
base_service.rb
app/services/issues/base_service.rb
+4
-0
update_service.rb
app/services/issues/update_service.rb
+4
-0
No files found.
app/models/note.rb
View file @
7edf65d1
...
...
@@ -90,6 +90,22 @@ class Note < ActiveRecord::Base
create
(
note_options
,
without_protection:
true
)
end
def
create_milestone_change_note
(
noteable
,
project
,
author
,
milestone
)
body
=
if
milestone
.
nil?
'_Milestone removed_'
else
"_Milestone changed to
#{
milestone
.
title
}
_"
end
create
({
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
,
system:
true
},
without_protection:
true
)
end
def
create_assignee_change_note
(
noteable
,
project
,
author
,
assignee
)
body
=
assignee
.
nil?
?
'_Assignee removed_'
:
"_Reassigned to @
#{
assignee
.
username
}
_"
...
...
app/services/issues/base_service.rb
View file @
7edf65d1
...
...
@@ -10,5 +10,9 @@ module Issues
def
execute_hooks
(
issue
)
issue
.
project
.
execute_hooks
(
issue
.
to_hook_data
,
:issue_hooks
)
end
def
create_milestone_note
(
issue
)
Note
.
create_milestone_change_note
(
issue
,
issue
.
project
,
current_user
,
issue
.
milestone
)
end
end
end
app/services/issues/update_service.rb
View file @
7edf65d1
...
...
@@ -13,6 +13,10 @@ module Issues
if
params
.
present?
&&
issue
.
update_attributes
(
params
)
issue
.
reset_events_cache
if
issue
.
previous_changes
.
include?
(
'milestone_id'
)
create_milestone_note
(
issue
)
end
if
issue
.
previous_changes
.
include?
(
'assignee_id'
)
notification_service
.
reassigned_issue
(
issue
,
current_user
)
create_assignee_note
(
issue
)
...
...
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