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
02a2422e
Commit
02a2422e
authored
Nov 10, 2016
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to reset estimated time through the `remove_estimation` command.
parent
a45fa017
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
1 deletion
+28
-1
app/services/slash_commands/interpret_service.rb
app/services/slash_commands/interpret_service.rb
+9
-0
app/services/system_note_service.rb
app/services/system_note_service.rb
+5
-1
doc/user/project/slash_commands.md
doc/user/project/slash_commands.md
+1
-0
spec/services/slash_commands/interpret_service_spec.rb
spec/services/slash_commands/interpret_service_spec.rb
+13
-0
No files found.
app/services/slash_commands/interpret_service.rb
View file @
02a2422e
...
...
@@ -275,6 +275,15 @@ module SlashCommands
end
end
desc
'Remove the estimated time'
condition
do
issuable
.
persisted?
&&
current_user
.
can?
(
:"admin_
#{
issuable
.
to_ability_name
}
"
,
project
)
end
command
:remove_estimation
do
@updates
[
:time_estimate
]
=
0
end
def
find_label_ids
(
labels_param
)
label_ids_by_reference
=
extract_references
(
labels_param
,
:label
).
map
(
&
:id
)
labels_ids_by_name
=
LabelsFinder
.
new
(
current_user
,
project_id:
project
.
id
,
name:
labels_param
.
split
).
execute
.
select
(
:id
)
...
...
app/services/system_note_service.rb
View file @
02a2422e
...
...
@@ -126,7 +126,11 @@ module SystemNoteService
def
change_time_estimate
(
noteable
,
project
,
author
)
parsed_time
=
ChronicDuration
.
output
(
noteable
.
time_estimate
,
format: :short
)
body
=
"Changed time estimate of this
#{
noteable
.
human_class_name
}
to
#{
parsed_time
}
"
body
=
if
parsed_time
"Changed time estimate of this
#{
noteable
.
human_class_name
}
to
#{
parsed_time
}
"
else
"Removed time estimate on this
#{
noteable
.
human_class_name
}
"
end
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
end
...
...
doc/user/project/slash_commands.md
View file @
02a2422e
...
...
@@ -30,4 +30,5 @@ do.
|
`/remove_due_date`
| Remove due date |
|
`/wip`
| Toggle the Work In Progress status |
|
<code>
/estimate
<
1w 3d 2h 14m
>
</code>
| Set time estimate |
|
`/remove_estimation`
| Remove estimated time |
|
<code>
/spend
<
1h 30m
|
-1h 5m
>
</code>
| Add or substract spent time |
spec/services/slash_commands/interpret_service_spec.rb
View file @
02a2422e
...
...
@@ -226,6 +226,14 @@ describe SlashCommands::InterpretService, services: true do
end
end
shared_examples
'remove_estimation command'
do
it
'populates time_estimate: "0" if content contains /remove_estimation'
do
_
,
updates
=
service
.
execute
(
content
,
issuable
)
expect
(
updates
).
to
eq
(
time_estimate:
0
)
end
end
shared_examples
'empty command'
do
it
'populates {} if content contains an unsupported command'
do
_
,
updates
=
service
.
execute
(
content
,
issuable
)
...
...
@@ -497,6 +505,11 @@ describe SlashCommands::InterpretService, services: true do
let
(
:issuable
)
{
issue
}
end
it_behaves_like
'remove_estimation command'
do
let
(
:content
)
{
'/remove_estimation'
}
let
(
:issuable
)
{
issue
}
end
context
'when current_user cannot :admin_issue'
do
let
(
:visitor
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
author:
visitor
)
}
...
...
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