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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ac0358b5
Commit
ac0358b5
authored
Nov 03, 2016
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add system note when time estimate for Issue/MergeRequest is changed.
parent
88a630c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
0 deletions
+29
-0
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+5
-0
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+4
-0
app/services/system_note_service.rb
app/services/system_note_service.rb
+20
-0
No files found.
app/services/issuable_base_service.rb
View file @
ac0358b5
...
...
@@ -36,6 +36,11 @@ class IssuableBaseService < BaseService
end
end
def
create_time_estimate_note
(
issuable
)
SystemNoteService
.
change_time_estimate
(
issuable
,
issuable
.
project
,
current_user
,
issuable
.
time_estimate
)
end
def
filter_params
(
issuable_ability_name
=
:issue
)
filter_assignee
filter_milestone
...
...
app/services/issues/update_service.rb
View file @
ac0358b5
...
...
@@ -28,6 +28,10 @@ module Issues
create_confidentiality_note
(
issue
)
end
if
issue
.
previous_changes
.
include?
(
'time_estimate'
)
create_time_estimate_note
(
issue
)
end
added_labels
=
issue
.
labels
-
old_labels
if
added_labels
.
present?
notification_service
.
relabeled_issue
(
issue
,
added_labels
,
current_user
)
...
...
app/services/system_note_service.rb
View file @
ac0358b5
...
...
@@ -111,6 +111,26 @@ module SystemNoteService
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
end
# Called when the estimated time of a Noteable is changed
#
# noteable - Noteable object
# project - Project owning noteable
# author - User performing the change
# milestone - Milestone being assigned, or nil
#
# Example Note text:
#
# "Changed estimate of this issue to 3d 5h"
#
# Returns the created Note object
def
change_time_estimate
(
noteable
,
project
,
author
,
time_estimate
)
parsed_time
=
ChronicDuration
.
output
(
time_estimate
,
format: :short
)
body
=
"Changed estimate of this
#{
noteable
.
to_ability_name
}
to
#{
parsed_time
}
"
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
end
# Called when the status of a Noteable is changed
#
# noteable - Noteable object
...
...
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