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
Jérome Perrin
gitlab-ce
Commits
3e7eeefc
Commit
3e7eeefc
authored
Aug 17, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address feedback
parent
8b8a4626
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
23 deletions
+19
-23
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+1
-3
app/services/slash_commands/interpret_service.rb
app/services/slash_commands/interpret_service.rb
+2
-3
lib/gitlab/slash_commands/command_definition.rb
lib/gitlab/slash_commands/command_definition.rb
+8
-8
lib/gitlab/slash_commands/extractor.rb
lib/gitlab/slash_commands/extractor.rb
+8
-9
No files found.
app/services/issuable_base_service.rb
View file @
3e7eeefc
...
...
@@ -193,9 +193,7 @@ class IssuableBaseService < BaseService
todo_service
.
mark_todo
(
issuable
,
current_user
)
when
'done'
todo
=
TodosFinder
.
new
(
current_user
).
execute
.
find_by
(
target:
issuable
)
if
todo
todo_service
.
mark_todos_as_done
([
todo
],
current_user
)
end
todo_service
.
mark_todos_as_done
([
todo
],
current_user
)
if
todo
end
end
...
...
app/services/slash_commands/interpret_service.rb
View file @
3e7eeefc
...
...
@@ -18,11 +18,11 @@ module SlashCommands
content
,
commands
=
extractor
.
extract_commands
(
content
,
opts
)
commands
.
each
do
|
name
,
*
args
|
commands
.
each
do
|
name
,
args
|
definition
=
self
.
class
.
command_definitions_by_name
[
name
.
to_sym
]
next
unless
definition
definition
.
execute
(
self
,
opts
,
*
args
)
definition
.
execute
(
self
,
opts
,
args
)
end
[
content
,
@updates
]
...
...
@@ -76,7 +76,6 @@ module SlashCommands
command
:assign
do
|
assignee_param
|
user
=
extract_references
(
assignee_param
,
:user
).
first
user
||=
User
.
find_by
(
username:
assignee_param
)
user
||=
User
.
find_by
(
name:
assignee_param
)
@updates
[
:assignee_id
]
=
user
.
id
if
user
end
...
...
lib/gitlab/slash_commands/command_definition.rb
View file @
3e7eeefc
...
...
@@ -28,13 +28,13 @@ module Gitlab
context
.
instance_exec
(
&
condition_block
)
end
def
execute
(
context
,
opts
,
*
args
)
def
execute
(
context
,
opts
,
args
)
return
if
noop?
||
!
available?
(
opts
)
block_arity
=
action_block
.
arity
return
unless
block_arity
==
-
1
||
block_arity
==
args
.
size
return
unless
(
args
.
present?
&&
block_arity
==
1
)
||
(
args
.
blank?
&&
block_arity
<=
0
)
context
.
instance_exec
(
*
args
,
&
action_block
)
context
.
instance_exec
(
args
,
&
action_block
)
end
def
to_h
(
opts
)
...
...
lib/gitlab/slash_commands/extractor.rb
View file @
3e7eeefc
...
...
@@ -50,15 +50,6 @@ module Gitlab
end
private
def
command_names
(
opts
)
command_definitions
.
flat_map
do
|
command
|
next
if
command
.
noop?
command
.
all_names
end
.
compact
end
# Builds a regular expression to match known commands.
# First match group captures the command name and
# second match group captures its arguments.
...
...
@@ -117,6 +108,14 @@ module Gitlab
)
}mx
end
def
command_names
(
opts
)
command_definitions
.
flat_map
do
|
command
|
next
if
command
.
noop?
command
.
all_names
end
.
compact
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