Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
f0889bdf
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f0889bdf
编写于
12月 16, 2016
作者:
Z
Z.J. van de Weg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Incorporate review
上级
7363a7d3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
21 deletion
+21
-21
app/controllers/projects/services_controller.rb
app/controllers/projects/services_controller.rb
+1
-1
app/models/project_services/mattermost_slash_commands_service.rb
...els/project_services/mattermost_slash_commands_service.rb
+20
-6
app/views/projects/mattermost/new.html.haml
app/views/projects/mattermost/new.html.haml
+0
-2
lib/mattermost/command.rb
lib/mattermost/command.rb
+0
-12
未找到文件。
app/controllers/projects/services_controller.rb
浏览文件 @
f0889bdf
...
...
@@ -3,7 +3,7 @@ class Projects::ServicesController < Projects::ApplicationController
# Authorize
before_action
:authorize_admin_project!
before_action
:service
,
only:
[
:edit
,
:update
,
:test
,
:configure
]
before_action
:service
,
only:
[
:edit
,
:update
,
:test
]
respond_to
:html
...
...
app/models/project_services/mattermost_slash_commands_service.rb
浏览文件 @
f0889bdf
...
...
@@ -25,15 +25,12 @@ class MattermostSlashCommandsService < ChatService
]
end
def
configure
(
host
,
current_user
,
team_id
:,
trigger
:,
url
:,
icon_url
:
)
def
configure
(
host
,
current_user
,
params
)
new_token
=
Mattermost
::
Session
.
new
(
host
,
current_user
).
with_session
do
Mattermost
::
Command
.
create
(
team_id
,
trigger:
trigger
||
@service
.
project
.
path
,
url:
url
,
icon_url:
icon_url
)
Mattermost
::
Command
.
create
(
params
[
:team_id
],
command
)
end
update!
(
token:
new_token
)
update!
(
token:
new_token
,
active:
true
)
end
def
trigger
(
params
)
...
...
@@ -50,6 +47,23 @@ class MattermostSlashCommandsService < ChatService
private
def
command
(
trigger
:,
url
:,
icon_url
:)
pretty_project_name
=
project
.
name_with_namespace
{
auto_complete:
true
,
auto_complete_desc:
"Perform common operations on:
#{
pretty_project_name
}
"
,
auto_complete_hint:
'[help]'
,
description:
"Perform common operations on:
#{
pretty_project_name
}
"
,
display_name:
"GitLab /
#{
pretty_project_name
}
"
,
method:
'P'
,
user_name:
'GitLab'
,
trigger:
trigger
,
url:
url
,
icon_url:
icon_url
}
end
def
find_chat_user
(
params
)
ChatNames
::
FindUserService
.
new
(
self
,
params
).
execute
end
...
...
app/views/projects/mattermost/new.html.haml
浏览文件 @
f0889bdf
=
"hello world"
=
@teams
=
form_for
(
:create
,
method: :post
,
url:
configure_namespace_project_mattermost_path
(
@project
.
namespace
,
@project
,
))
do
|
f
|
=
"Team ID"
=
f
.
text_field
(
:team_id
)
...
...
lib/mattermost/command.rb
浏览文件 @
f0889bdf
module
Mattermost
class
Command
<
Session
def
self
.
create
(
team_id
,
trigger:
'gitlab'
,
url
:,
icon_url
:)
command
=
{
auto_complete:
true
,
auto_complete_desc:
'List all available commands'
,
auto_complete_hint:
'[help]'
,
description:
'Perform common operations on GitLab'
,
display_name:
'GitLab Slash Commands'
,
method:
'P'
,
user_name:
'GitLab'
,
trigger:
trigger
,
url:
url
,
icon_url:
icon_url
}
post_command
(
command
)[
'token'
]
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录