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
78709bb9
Commit
78709bb9
authored
Jan 08, 2017
by
Luke "Jared" Bennett
Committed by
Clement Ho
Feb 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added small improvments to the chat slash command services
Updated specs
parent
1bbc99f1
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
80 additions
and
56 deletions
+80
-56
app/assets/stylesheets/framework/lists.scss
app/assets/stylesheets/framework/lists.scss
+4
-0
app/models/project_services/chat_slash_commands_service.rb
app/models/project_services/chat_slash_commands_service.rb
+1
-1
app/models/project_services/mattermost_slash_commands_service.rb
...els/project_services/mattermost_slash_commands_service.rb
+2
-2
app/models/project_services/slack_slash_commands_service.rb
app/models/project_services/slack_slash_commands_service.rb
+2
-2
app/views/projects/services/mattermost_slash_commands/_detailed_help.html.haml
...rvices/mattermost_slash_commands/_detailed_help.html.haml
+19
-11
app/views/projects/services/mattermost_slash_commands/_help.html.haml
...ojects/services/mattermost_slash_commands/_help.html.haml
+10
-7
app/views/projects/services/slack_slash_commands/_help.html.haml
...ws/projects/services/slack_slash_commands/_help.html.haml
+18
-14
doc/user/project/integrations/img/mattermost_config_help.png
doc/user/project/integrations/img/mattermost_config_help.png
+0
-0
doc/user/project/integrations/img/slack_setup.png
doc/user/project/integrations/img/slack_setup.png
+0
-0
spec/features/projects/services/mattermost_slash_command_spec.rb
...atures/projects/services/mattermost_slash_command_spec.rb
+15
-7
spec/features/projects/services/slack_slash_command_spec.rb
spec/features/projects/services/slack_slash_command_spec.rb
+9
-12
No files found.
app/assets/stylesheets/framework/lists.scss
View file @
78709bb9
...
@@ -307,3 +307,7 @@ ul.controls {
...
@@ -307,3 +307,7 @@ ul.controls {
}
}
}
}
}
}
ul
.indent-list
{
padding
:
10px
0
0
30px
;
}
app/models/project_services/chat_slash_commands_service.rb
View file @
78709bb9
...
@@ -23,7 +23,7 @@ class ChatSlashCommandsService < Service
...
@@ -23,7 +23,7 @@ class ChatSlashCommandsService < Service
def
fields
def
fields
[
[
{
type:
'text'
,
name:
'token'
,
placeholder:
''
}
{
type:
'text'
,
name:
'token'
,
placeholder:
'
XXxxXXxxXXxxXXxxXXxxXXxx
'
}
]
]
end
end
...
...
app/models/project_services/mattermost_slash_commands_service.rb
View file @
78709bb9
...
@@ -8,11 +8,11 @@ class MattermostSlashCommandsService < ChatSlashCommandsService
...
@@ -8,11 +8,11 @@ class MattermostSlashCommandsService < ChatSlashCommandsService
end
end
def
title
def
title
'Mattermost
Command
'
'Mattermost
slash commands
'
end
end
def
description
def
description
"Perform common operations
on GitLab
in Mattermost"
"Perform common operations in Mattermost"
end
end
def
self
.
to_param
def
self
.
to_param
...
...
app/models/project_services/slack_slash_commands_service.rb
View file @
78709bb9
...
@@ -2,11 +2,11 @@ class SlackSlashCommandsService < ChatSlashCommandsService
...
@@ -2,11 +2,11 @@ class SlackSlashCommandsService < ChatSlashCommandsService
include
TriggersHelper
include
TriggersHelper
def
title
def
title
'Slack
Command
'
'Slack
slash commands
'
end
end
def
description
def
description
"Perform common operations
on GitLab
in Slack"
"Perform common operations in Slack"
end
end
def
self
.
to_param
def
self
.
to_param
...
...
app/views/projects/services/mattermost_slash_commands/_detailed_help.html.haml
View file @
78709bb9
-
run_actions_text
=
"Perform common operations on
this
project:
#{
@project
.
name_with_namespace
}
"
-
run_actions_text
=
"Perform common operations on
GitLab
project:
#{
@project
.
name_with_namespace
}
"
To setup this service:
%p
To setup this service:
%ul
.list-unstyled
%ul
.list-unstyled
.indent-list
%li
%li
1.
1.
=
link_to
'Enable custom slash commands'
,
'https://docs.mattermost.com/developer/slash-commands.html#enabling-custom-commands'
=
link_to
'https://docs.mattermost.com/developer/slash-commands.html#enabling-custom-commands'
,
target:
'_blank'
,
rel:
'noreferrer noopener nofollow'
do
Enable custom slash commands
=
icon
(
'external-link'
)
on your Mattermost installation
on your Mattermost installation
%li
%li
2.
2.
=
link_to
'Add a slash command'
,
'https://docs.mattermost.com/developer/slash-commands.html#set-up-a-custom-command'
=
link_to
'https://docs.mattermost.com/developer/slash-commands.html#set-up-a-custom-command'
,
target:
'_blank'
,
rel:
'noreferrer noopener nofollow'
do
in Mattermost with these options:
Add a slash command
=
icon
(
'external-link'
)
in your Mattermost team with these options:
%hr
%hr
.help-form
.help-form
...
@@ -83,9 +86,14 @@ To setup this service:
...
@@ -83,9 +86,14 @@ To setup this service:
%hr
%hr
%ul
.list-unstyled
%ul
.list-unstyled
.indent-list
%li
%li
3. After adding the slash command, paste the
3. Paste the
%strong
Token
%strong
token
into the field below
into the field below
%li
4. Select the
%strong
Active
checkbox, press
%strong
Save changes
and start using GitLab inside Mattermost!
app/views/projects/services/mattermost_slash_commands/_help.html.haml
View file @
78709bb9
-
enabled
=
Gitlab
.
config
.
mattermost
.
enabled
-
enabled
=
Gitlab
.
config
.
mattermost
.
enabled
.well
.well
This service allows GitLab users to perform common operations on this
%p
This service allows users to perform common operations on this
project by entering slash commands in Mattermost.
project by entering slash commands in Mattermost.
%br
=
link_to
help_page_path
(
'user/project/integrations/mattermost_slash_commands.md'
),
target:
'_blank'
,
ref:
'noreferrer nofollow noopener'
do
View documentation
=
icon
(
'external-link'
)
%p
.inline
See list of available commands in Mattermost after setting up this service,
See list of available commands in Mattermost after setting up this service,
by entering
by entering
%code
/
<
command_trigger_word
>
help
%kbd
.inline
/
<
trigger
>
help
-
unless
enabled
||
@service
.
template?
-
unless
enabled
||
@service
.
template?
=
render
'projects/services/mattermost_slash_commands/detailed_help'
,
subject:
@service
=
render
'projects/services/mattermost_slash_commands/detailed_help'
,
subject:
@service
...
...
app/views/projects/services/slack_slash_commands/_help.html.haml
View file @
78709bb9
-
pretty_name
=
defined?
(
@project
)
?
@project
.
name_with_namespace
:
"namespace / path"
-
pretty_name
=
defined?
(
@project
)
?
@project
.
name_with_namespace
:
'namespace / path'
-
run_actions_text
=
"Perform common operations on
this
project:
#{
pretty_name
}
"
-
run_actions_text
=
"Perform common operations on
GitLab
project:
#{
pretty_name
}
"
.well
.well
This service allows GitLab users to perform common operations on this
%p
This service allows users to perform common operations on this
project by entering slash commands in Slack.
project by entering slash commands in Slack.
%br
=
link_to
help_page_path
(
'user/project/integrations/slack_slash_commands.md'
),
target:
'_blank'
,
ref:
'noreferrer nofollow noopener'
do
View documentation
=
icon
(
'external-link'
)
%p
.inline
See list of available commands in Slack after setting up this service,
See list of available commands in Slack after setting up this service,
by entering
by entering
%code
/
<
command
>
help
%kbd
.inline
/
<
command
>
help
%br
%br
-
unless
@service
.
template?
-
unless
@service
.
template?
To setup this service:
%p
To setup this service:
%ul
.list-unstyled
%ul
.list-unstyled
.indent-list
%li
%li
1.
1.
=
link_to
'Add a slash command'
,
'https://my.slack.com/services/new/slash-commands'
=
link_to
'https://my.slack.com/services/new/slash-commands'
,
target:
'_blank'
,
rel:
'noreferrer noopener nofollow'
do
Add a slash command
=
icon
(
'external-link'
)
in your Slack team with these options:
in your Slack team with these options:
%hr
%hr
...
@@ -82,7 +86,7 @@
...
@@ -82,7 +86,7 @@
%hr
%hr
%ul
.list-unstyled
%ul
.list-unstyled
.indent-list
%li
%li
2. Paste the
2. Paste the
%strong
Token
%strong
Token
...
...
doc/user/project/integrations/img/mattermost_config_help.png
View replaced file @
1bbc99f1
View file @
78709bb9
61.7 KB
|
W:
|
H:
100 KB
|
W:
|
H:
2-up
Swipe
Onion skin
doc/user/project/integrations/img/slack_setup.png
View replaced file @
1bbc99f1
View file @
78709bb9
123 KB
|
W:
|
H:
84.3 KB
|
W:
|
H:
2-up
Swipe
Onion skin
spec/features/projects/services/mattermost_slash_command_spec.rb
View file @
78709bb9
require
'spec_helper'
require
'spec_helper'
feature
'Setup Mattermost slash commands'
,
feature:
true
do
feature
'Setup Mattermost slash commands'
,
feature:
true
do
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:service
)
{
project
.
create_mattermost_slash_commands_service
}
let
(
:service
)
{
project
.
create_mattermost_slash_commands_service
}
...
@@ -15,11 +13,15 @@ feature 'Setup Mattermost slash commands', feature: true do
...
@@ -15,11 +13,15 @@ feature 'Setup Mattermost slash commands', feature: true do
visit
edit_namespace_project_service_path
(
project
.
namespace
,
project
,
service
)
visit
edit_namespace_project_service_path
(
project
.
namespace
,
project
,
service
)
end
end
describe
'user visits the mattermost slash command config page'
,
js:
true
do
describe
'user visits the mattermost slash command config page'
do
it
'shows a help message'
do
it
'shows a help message'
do
wait_for_ajax
expect
(
page
).
to
have_content
(
"This service allows users to perform common"
)
end
it
'shows a token placeholder'
do
token_placeholder
=
find_field
(
'service_token'
)[
'placeholder'
]
expect
(
page
).
to
have_content
(
"This service allows GitLab users to perform common"
)
expect
(
token_placeholder
).
to
eq
(
'XXxxXXxxXXxxXXxxXXxxXXxx'
)
end
end
it
'shows the token after saving'
do
it
'shows the token after saving'
do
...
@@ -64,7 +66,7 @@ feature 'Setup Mattermost slash commands', feature: true do
...
@@ -64,7 +66,7 @@ feature 'Setup Mattermost slash commands', feature: true do
select_element
=
find
(
'select#mattermost_team_id'
)
select_element
=
find
(
'select#mattermost_team_id'
)
selected_option
=
select_element
.
find
(
'option[selected]'
)
selected_option
=
select_element
.
find
(
'option[selected]'
)
expect
(
select_element
[
'disabled'
]).
to
be
(
true
)
expect
(
select_element
[
'disabled'
]).
to
eq
(
'disabled'
)
expect
(
selected_option
).
to
have_content
(
team_name
.
to_s
)
expect
(
selected_option
).
to
have_content
(
team_name
.
to_s
)
end
end
...
@@ -93,7 +95,7 @@ feature 'Setup Mattermost slash commands', feature: true do
...
@@ -93,7 +95,7 @@ feature 'Setup Mattermost slash commands', feature: true do
select_element
=
find
(
'select#mattermost_team_id'
)
select_element
=
find
(
'select#mattermost_team_id'
)
selected_option
=
select_element
.
find
(
'option[selected]'
)
selected_option
=
select_element
.
find
(
'option[selected]'
)
expect
(
select_element
[
'disabled'
]).
to
be
(
false
)
expect
(
select_element
[
'disabled'
]).
to
be
(
nil
)
expect
(
selected_option
).
to
have_content
(
'Select team...'
)
expect
(
selected_option
).
to
have_content
(
'Select team...'
)
# The 'Select team...' placeholder is item `0`.
# The 'Select team...' placeholder is item `0`.
expect
(
select_element
.
all
(
'option'
).
count
).
to
eq
(
3
)
expect
(
select_element
.
all
(
'option'
).
count
).
to
eq
(
3
)
...
@@ -135,6 +137,12 @@ feature 'Setup Mattermost slash commands', feature: true do
...
@@ -135,6 +137,12 @@ feature 'Setup Mattermost slash commands', feature: true do
expect
(
value
).
to
match
(
"api/v3/projects/
#{
project
.
id
}
/services/mattermost_slash_commands/trigger"
)
expect
(
value
).
to
match
(
"api/v3/projects/
#{
project
.
id
}
/services/mattermost_slash_commands/trigger"
)
end
end
it
'shows a token placeholder'
do
token_placeholder
=
find_field
(
'service_token'
)[
'placeholder'
]
expect
(
token_placeholder
).
to
eq
(
'XXxxXXxxXXxxXXxxXXxxXXxx'
)
end
end
end
end
end
...
...
spec/features/projects/services/slack_slash_command_spec.rb
View file @
78709bb9
require
'spec_helper'
require
'spec_helper'
feature
'Slack slash commands'
,
feature:
true
do
feature
'Slack slash commands'
,
feature:
true
do
include
WaitForAjax
given
(
:user
)
{
create
(
:user
)
}
given
(
:user
)
{
create
(
:user
)
}
given
(
:project
)
{
create
(
:project
)
}
given
(
:project
)
{
create
(
:project
)
}
given
(
:service
)
{
project
.
create_slack_slash_commands_service
}
given
(
:service
)
{
project
.
create_slack_slash_commands_service
}
...
@@ -10,19 +8,20 @@ feature 'Slack slash commands', feature: true do
...
@@ -10,19 +8,20 @@ feature 'Slack slash commands', feature: true do
background
do
background
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
login_as
(
user
)
end
scenario
'user visits the slack slash command config page and shows a help message'
,
js:
true
do
visit
edit_namespace_project_service_path
(
project
.
namespace
,
project
,
service
)
visit
edit_namespace_project_service_path
(
project
.
namespace
,
project
,
service
)
end
wait_for_ajax
it
'shows a token placeholder'
do
token_placeholder
=
find_field
(
'service_token'
)[
'placeholder'
]
expect
(
page
).
to
have_content
(
'This service allows GitLab users to perform common
'
)
expect
(
token_placeholder
).
to
eq
(
'XXxxXXxxXXxxXXxxXXxxXXxx
'
)
end
end
scenario
'shows the token after saving'
do
it
'shows a help message'
do
visit
edit_namespace_project_service_path
(
project
.
namespace
,
project
,
service
)
expect
(
page
).
to
have_content
(
'This service allows users to perform common'
)
end
it
'shows the token after saving'
do
fill_in
'service_token'
,
with:
'token'
fill_in
'service_token'
,
with:
'token'
click_on
'Save'
click_on
'Save'
...
@@ -31,9 +30,7 @@ feature 'Slack slash commands', feature: true do
...
@@ -31,9 +30,7 @@ feature 'Slack slash commands', feature: true do
expect
(
value
).
to
eq
(
'token'
)
expect
(
value
).
to
eq
(
'token'
)
end
end
scenario
'shows the correct trigger url'
do
it
'shows the correct trigger url'
do
visit
edit_namespace_project_service_path
(
project
.
namespace
,
project
,
service
)
value
=
find_field
(
'url'
).
value
value
=
find_field
(
'url'
).
value
expect
(
value
).
to
match
(
"api/v3/projects/
#{
project
.
id
}
/services/slack_slash_commands/trigger"
)
expect
(
value
).
to
match
(
"api/v3/projects/
#{
project
.
id
}
/services/slack_slash_commands/trigger"
)
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