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
53db7d1d
Commit
53db7d1d
authored
Feb 06, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pms-lowercase-system-notes' into 'master'
Make all system notes lowercase See merge request !8807
parents
e438b30a
ab92e025
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
14 deletions
+22
-14
app/services/system_note_service.rb
app/services/system_note_service.rb
+13
-9
changelogs/unreleased/pms-lowercase-system-notes.yml
changelogs/unreleased/pms-lowercase-system-notes.yml
+4
-0
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+5
-5
No files found.
app/services/system_note_service.rb
View file @
53db7d1d
...
...
@@ -118,16 +118,18 @@ module SystemNoteService
#
# Example Note text:
#
# "Changed estimate of this issue to 3d 5h"
# "removed time estimate"
#
# "changed time estimate to 3d 5h"
#
# Returns the created Note object
def
change_time_estimate
(
noteable
,
project
,
author
)
parsed_time
=
Gitlab
::
TimeTrackingFormatter
.
output
(
noteable
.
time_estimate
)
body
=
if
noteable
.
time_estimate
==
0
"
Removed time estimate on this
#{
noteable
.
human_class_name
}
"
"
removed time estimate
"
else
"
Changed time estimate of this
#{
noteable
.
human_class_name
}
to
#{
parsed_time
}
"
"
changed time estimate
to
#{
parsed_time
}
"
end
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
...
...
@@ -142,7 +144,9 @@ module SystemNoteService
#
# Example Note text:
#
# "Added 2h 30m of time spent on this issue"
# "removed time spent"
#
# "added 2h 30m of time spent"
#
# Returns the created Note object
...
...
@@ -150,11 +154,11 @@ module SystemNoteService
time_spent
=
noteable
.
time_spent
if
time_spent
==
:reset
body
=
"
Removed time spent on this
#{
noteable
.
human_class_name
}
"
body
=
"
removed time spent
"
else
parsed_time
=
Gitlab
::
TimeTrackingFormatter
.
output
(
time_spent
.
abs
)
action
=
time_spent
>
0
?
'
Added'
:
'S
ubtracted'
body
=
"
#{
action
}
#{
parsed_time
}
of time spent
on this
#{
noteable
.
human_class_name
}
"
action
=
time_spent
>
0
?
'
added'
:
's
ubtracted'
body
=
"
#{
action
}
#{
parsed_time
}
of time spent"
end
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
...
...
@@ -221,7 +225,7 @@ module SystemNoteService
end
def
discussion_continued_in_issue
(
discussion
,
project
,
author
,
issue
)
body
=
"
Add
ed
#{
issue
.
to_reference
}
to continue this discussion"
body
=
"
creat
ed
#{
issue
.
to_reference
}
to continue this discussion"
note_attributes
=
discussion
.
reply_attributes
.
merge
(
project:
project
,
author:
author
,
note:
body
)
note_attributes
[
:type
]
=
note_attributes
.
delete
(
:note_type
)
...
...
@@ -260,7 +264,7 @@ module SystemNoteService
#
# Example Note text:
#
# "made the issue confidential"
#
"made the issue confidential"
#
# Returns the created Note object
def
change_issue_confidentiality
(
issue
,
project
,
author
)
...
...
changelogs/unreleased/pms-lowercase-system-notes.yml
0 → 100644
View file @
53db7d1d
---
title
:
Make all system notes lowercase
merge_request
:
8807
author
:
spec/services/system_note_service_spec.rb
View file @
53db7d1d
...
...
@@ -752,13 +752,13 @@ describe SystemNoteService, services: true do
it
'sets the note text'
do
noteable
.
update_attribute
(
:time_estimate
,
277200
)
expect
(
subject
.
note
).
to
eq
"
Changed time estimate of this issu
e to 1w 4d 5h"
expect
(
subject
.
note
).
to
eq
"
changed time estimat
e to 1w 4d 5h"
end
end
context
'without a time estimate'
do
it
'sets the note text'
do
expect
(
subject
.
note
).
to
eq
"
Removed time estimate on this issu
e"
expect
(
subject
.
note
).
to
eq
"
removed time estimat
e"
end
end
end
...
...
@@ -782,7 +782,7 @@ describe SystemNoteService, services: true do
it
'sets the note text'
do
spend_time!
(
277200
)
expect
(
subject
.
note
).
to
eq
"
Added 1w 4d 5h of time spent on this merge reques
t"
expect
(
subject
.
note
).
to
eq
"
added 1w 4d 5h of time spen
t"
end
end
...
...
@@ -790,7 +790,7 @@ describe SystemNoteService, services: true do
it
'sets the note text'
do
spend_time!
(
-
277200
)
expect
(
subject
.
note
).
to
eq
"
Subtracted 1w 4d 5h of time spent on this merge reques
t"
expect
(
subject
.
note
).
to
eq
"
subtracted 1w 4d 5h of time spen
t"
end
end
...
...
@@ -798,7 +798,7 @@ describe SystemNoteService, services: true do
it
'sets the note text'
do
spend_time!
(
:reset
)
expect
(
subject
.
note
).
to
eq
"
Removed time spent on this merge reques
t"
expect
(
subject
.
note
).
to
eq
"
removed time spen
t"
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