Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
3715c1cf
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,发现更多精彩内容 >>
提交
3715c1cf
编写于
7月 17, 2017
作者:
F
Felipe Artur
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix external issue trackers redirect
上级
05329d4a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
15 addition
and
11 deletion
+15
-11
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-1
app/models/project_services/gitlab_issue_tracker_service.rb
app/models/project_services/gitlab_issue_tracker_service.rb
+1
-1
app/models/project_services/issue_tracker_service.rb
app/models/project_services/issue_tracker_service.rb
+2
-2
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+10
-6
spec/models/project_services/gitlab_issue_tracker_service_spec.rb
...els/project_services/gitlab_issue_tracker_service_spec.rb
+1
-1
未找到文件。
app/controllers/projects/issues_controller.rb
浏览文件 @
3715c1cf
...
...
@@ -266,7 +266,7 @@ class Projects::IssuesController < Projects::ApplicationController
if
action_name
==
'new'
redirect_to
external
.
new_issue_path
else
redirect_to
external
.
project
_path
redirect_to
external
.
issue_tracker
_path
end
end
...
...
app/models/project_services/gitlab_issue_tracker_service.rb
浏览文件 @
3715c1cf
...
...
@@ -23,7 +23,7 @@ class GitlabIssueTrackerService < IssueTrackerService
project_issue_url
(
project
,
id:
iid
)
end
def
project
_path
def
issue_tracker
_path
project_issues_path
(
project
)
end
...
...
app/models/project_services/issue_tracker_service.rb
浏览文件 @
3715c1cf
...
...
@@ -20,8 +20,8 @@ class IssueTrackerService < Service
self
.
issues_url
.
gsub
(
':id'
,
iid
.
to_s
)
end
def
project
_path
read_attribute
(
:project_url
)
def
issue_tracker
_path
project_url
end
def
new_issue_path
...
...
spec/controllers/projects/issues_controller_spec.rb
浏览文件 @
3715c1cf
...
...
@@ -7,14 +7,16 @@ describe Projects::IssuesController do
describe
"GET #index"
do
context
'external issue tracker'
do
let!
(
:service
)
do
create
(
:custom_issue_tracker_service
,
project:
project
,
title:
'Custom Issue Tracker'
,
project_url:
'http://test.com'
)
end
it
'redirects to the external issue tracker'
do
external
=
double
(
project_path:
'https://example.com/project'
)
allow
(
project
).
to
receive
(
:external_issue_tracker
).
and_return
(
external
)
controller
.
instance_variable_set
(
:@project
,
project
)
get
:index
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
response
).
to
redirect_to
(
'https://example.com/project'
)
expect
(
response
).
to
redirect_to
(
service
.
issue_tracker_path
)
end
end
...
...
@@ -139,19 +141,21 @@ describe Projects::IssuesController do
end
context
'external issue tracker'
do
let!
(
:service
)
do
create
(
:custom_issue_tracker_service
,
project:
project
,
title:
'Custom Issue Tracker'
,
new_issue_url:
'http://test.com'
)
end
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
end
it
'redirects to the external issue tracker'
do
external
=
double
(
new_issue_path:
'https://example.com/issues/new'
)
allow
(
project
).
to
receive
(
:external_issue_tracker
).
and_return
(
external
)
controller
.
instance_variable_set
(
:@project
,
project
)
get
:new
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
response
).
to
redirect_to
(
'http
s://example.com/issues/new
'
)
expect
(
response
).
to
redirect_to
(
'http
://test.com
'
)
end
end
end
...
...
spec/models/project_services/gitlab_issue_tracker_service_spec.rb
浏览文件 @
3715c1cf
...
...
@@ -43,7 +43,7 @@ describe GitlabIssueTrackerService, models: true do
end
it
'gives the correct path'
do
expect
(
service
.
project
_path
).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues"
)
expect
(
service
.
issue_tracker
_path
).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues"
)
expect
(
service
.
new_issue_path
).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues/new"
)
expect
(
service
.
issue_path
(
432
)).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues/432"
)
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录