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
28f9a4dc
Commit
28f9a4dc
authored
Jun 04, 2018
by
Mark Chao
Committed by
Nick Thomas
Jun 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Extract EE specific files/lines for lib/gitlab/slash_commands"
parent
a02533bb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
88 additions
and
25 deletions
+88
-25
ee/lib/ee/gitlab/slash_commands/command.rb
ee/lib/ee/gitlab/slash_commands/command.rb
+22
-0
ee/lib/ee/gitlab/slash_commands/presenters/issue_base.rb
ee/lib/ee/gitlab/slash_commands/presenters/issue_base.rb
+24
-0
ee/lib/gitlab/slash_commands/application_help.rb
ee/lib/gitlab/slash_commands/application_help.rb
+1
-1
ee/spec/lib/gitlab/slash_commands/command_spec.rb
ee/spec/lib/gitlab/slash_commands/command_spec.rb
+9
-0
ee/spec/lib/gitlab/slash_commands/presenters/issue_show_spec.rb
...c/lib/gitlab/slash_commands/presenters/issue_show_spec.rb
+18
-0
lib/gitlab/slash_commands/command.rb
lib/gitlab/slash_commands/command.rb
+12
-9
lib/gitlab/slash_commands/presenters/issue_base.rb
lib/gitlab/slash_commands/presenters/issue_base.rb
+2
-5
spec/lib/gitlab/slash_commands/presenters/issue_show_spec.rb
spec/lib/gitlab/slash_commands/presenters/issue_show_spec.rb
+0
-10
No files found.
ee/lib/ee/gitlab/slash_commands/command.rb
0 → 100644
View file @
28f9a4dc
module
EE
module
Gitlab
module
SlashCommands
module
Command
extend
ActiveSupport
::
Concern
class_methods
do
extend
::
Gitlab
::
Utils
::
Override
override
:commands
def
commands
super
.
concat
(
[
::
Gitlab
::
SlashCommands
::
Run
]
)
end
end
end
end
end
end
ee/lib/ee/gitlab/slash_commands/presenters/issue_base.rb
0 → 100644
View file @
28f9a4dc
module
EE
module
Gitlab
module
SlashCommands
module
Presenters
module
IssueBase
extend
::
Gitlab
::
Utils
::
Override
override
:fields
def
fields
super
.
concat
(
[
{
title:
"Weight"
,
value:
resource
.
weight?
?
resource
.
weight
:
"_None_"
,
short:
true
}
]
)
end
end
end
end
end
end
ee/lib/gitlab/slash_commands/application_help.rb
View file @
28f9a4dc
...
...
@@ -16,7 +16,7 @@ module Gitlab
end
def
commands
Gitlab
::
SlashCommands
::
Command
::
COMMANDS
Gitlab
::
SlashCommands
::
Command
.
commands
end
end
end
...
...
ee/spec/lib/gitlab/slash_commands/command_spec.rb
0 → 100644
View file @
28f9a4dc
require
'spec_helper'
describe
Gitlab
::
SlashCommands
::
Command
do
describe
'.commands'
do
it
'includes EE specific commands'
do
expect
(
described_class
.
commands
).
to
include
(
Gitlab
::
SlashCommands
::
Run
)
end
end
end
ee/spec/lib/gitlab/slash_commands/presenters/issue_show_spec.rb
0 → 100644
View file @
28f9a4dc
require
'spec_helper'
describe
Gitlab
::
SlashCommands
::
Presenters
::
IssueShow
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:attachment
)
{
subject
[
:attachments
].
first
}
subject
{
described_class
.
new
(
issue
).
present
}
context
'issue with issue weight'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
weight:
3
)
}
let
(
:weight_attachment
)
{
attachment
[
:fields
].
find
{
|
a
|
a
[
:title
]
==
"Weight"
}
}
it
'shows the weight'
do
expect
(
weight_attachment
).
not_to
be_nil
expect
(
weight_attachment
[
:value
]).
to
be
(
3
)
end
end
end
lib/gitlab/slash_commands/command.rb
View file @
28f9a4dc
module
Gitlab
module
SlashCommands
class
Command
<
BaseCommand
COMMANDS
=
[
Gitlab
::
SlashCommands
::
IssueShow
,
Gitlab
::
SlashCommands
::
IssueNew
,
Gitlab
::
SlashCommands
::
IssueSearch
,
Gitlab
::
SlashCommands
::
IssueMove
,
Gitlab
::
SlashCommands
::
Deploy
,
Gitlab
::
SlashCommands
::
Run
].
freeze
prepend
EE
::
Gitlab
::
SlashCommands
::
Command
def
self
.
commands
[
Gitlab
::
SlashCommands
::
IssueShow
,
Gitlab
::
SlashCommands
::
IssueNew
,
Gitlab
::
SlashCommands
::
IssueSearch
,
Gitlab
::
SlashCommands
::
IssueMove
,
Gitlab
::
SlashCommands
::
Deploy
]
end
def
execute
command
,
match
=
match_command
...
...
@@ -38,7 +41,7 @@ module Gitlab
private
def
available_commands
COMMANDS
.
select
do
|
klass
|
self
.
class
.
commands
.
keep_if
do
|
klass
|
klass
.
available?
(
project
)
end
end
...
...
lib/gitlab/slash_commands/presenters/issue_base.rb
View file @
28f9a4dc
...
...
@@ -2,6 +2,8 @@ module Gitlab
module
SlashCommands
module
Presenters
module
IssueBase
prepend
EE
::
Gitlab
::
SlashCommands
::
Presenters
::
IssueBase
def
color
(
issuable
)
issuable
.
open?
?
'#38ae67'
:
'#d22852'
end
...
...
@@ -34,11 +36,6 @@ module Gitlab
title:
"Labels"
,
value:
resource
.
labels
.
any?
?
resource
.
label_names
.
join
(
', '
)
:
"_None_"
,
short:
true
},
{
title:
"Weight"
,
value:
resource
.
weight?
?
resource
.
weight
:
"_None_"
,
short:
true
}
]
end
...
...
spec/lib/gitlab/slash_commands/presenters/issue_show_spec.rb
View file @
28f9a4dc
...
...
@@ -49,14 +49,4 @@ describe Gitlab::SlashCommands::Presenters::IssueShow do
expect
(
attachment
[
:text
]).
to
start_with
(
"**Open**"
)
end
end
context
'issue with issue weight'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
weight:
3
)
}
let
(
:weight_attachment
)
{
subject
[
:attachments
].
first
[
:fields
].
find
{
|
a
|
a
[
:title
]
==
"Weight"
}
}
it
'shows the weight'
do
expect
(
weight_attachment
).
not_to
be_nil
expect
(
weight_attachment
[
:value
]).
to
be
(
3
)
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