Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
f9963fe0
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,体验更适合开发者的 AI 搜索 >>
提交
f9963fe0
编写于
12月 21, 2016
作者:
F
Felipe Artur
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Parse JIRA issue references even if Issue Tracker is disabled
上级
7e88b242
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
41 deletion
+52
-41
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+16
-37
app/policies/project_policy.rb
app/policies/project_policy.rb
+10
-3
changelogs/unreleased/issue_25682.yml
changelogs/unreleased/issue_25682.yml
+4
-0
spec/features/projects/features_visibility_spec.rb
spec/features/projects/features_visibility_spec.rb
+11
-0
spec/lib/banzai/reference_parser/external_issue_parser_spec.rb
...lib/banzai/reference_parser/external_issue_parser_spec.rb
+11
-1
未找到文件。
app/helpers/projects_helper.rb
浏览文件 @
f9963fe0
...
...
@@ -171,48 +171,27 @@ module ProjectsHelper
nav_tabs
<<
:merge_requests
end
if
can?
(
current_user
,
:read_pipeline
,
project
)
nav_tabs
<<
:pipelines
end
if
can?
(
current_user
,
:read_build
,
project
)
nav_tabs
<<
:builds
end
if
Gitlab
.
config
.
registry
.
enabled
&&
can?
(
current_user
,
:read_container_image
,
project
)
nav_tabs
<<
:container_registry
end
if
can?
(
current_user
,
:read_environment
,
project
)
nav_tabs
<<
:environments
end
if
can?
(
current_user
,
:admin_project
,
project
)
nav_tabs
<<
:settings
end
if
can?
(
current_user
,
:read_project_member
,
project
)
nav_tabs
<<
:team
end
if
can?
(
current_user
,
:read_issue
,
project
)
nav_tabs
<<
:issues
end
if
can?
(
current_user
,
:read_wiki
,
project
)
nav_tabs
<<
:wiki
end
if
can?
(
current_user
,
:read_project_snippet
,
project
)
nav_tabs
<<
:snippets
end
if
can?
(
current_user
,
:read_label
,
project
)
nav_tabs
<<
:labels
end
tab_ability_map
=
{
environments: :read_environment
,
milestones: :read_milestone
,
pipelines: :read_pipeline
,
snippets: :read_project_snippet
,
settings: :admin_project
,
builds: :read_build
,
labels: :read_label
,
issues: :read_issue
,
team: :read_project_member
,
wiki: :read_wiki
}
if
can?
(
current_user
,
:read_milestone
,
project
)
nav_tabs
<<
:milestones
tab_ability_map
.
each
do
|
tab
,
ability
|
if
can?
(
current_user
,
ability
,
project
)
nav_tabs
<<
tab
end
end
nav_tabs
.
flatten
...
...
app/policies/project_policy.rb
浏览文件 @
f9963fe0
...
...
@@ -171,9 +171,7 @@ class ProjectPolicy < BasePolicy
def
disabled_features!
repository_enabled
=
project
.
feature_available?
(
:repository
,
user
)
unless
project
.
feature_available?
(
:issues
,
user
)
cannot!
(
*
named_abilities
(
:issue
))
end
block_issues_abilities
unless
project
.
feature_available?
(
:merge_requests
,
user
)
&&
repository_enabled
cannot!
(
*
named_abilities
(
:merge_request
))
...
...
@@ -250,6 +248,15 @@ class ProjectPolicy < BasePolicy
)
end
def
block_issues_abilities
unless
project
.
feature_available?
(
:issues
,
user
)
cannot!
:read_issue
if
project
.
default_issues_tracker?
cannot!
:create_issue
cannot!
:update_issue
cannot!
:admin_issue
end
end
def
named_abilities
(
name
)
[
:"read_
#{
name
}
"
,
...
...
changelogs/unreleased/issue_25682.yml
0 → 100644
浏览文件 @
f9963fe0
---
title
:
Parse JIRA issue references even if Issue Tracker is disabled
merge_request
:
author
:
spec/features/projects/features_visibility_spec.rb
浏览文件 @
f9963fe0
...
...
@@ -42,6 +42,17 @@ describe 'Edit Project Settings', feature: true do
end
end
context
"When external issue tracker is enabled"
do
it
"does not hide issues tab"
do
project
.
project_feature
.
update
(
issues_access_level:
ProjectFeature
::
DISABLED
)
allow_any_instance_of
(
Project
).
to
receive
(
:external_issue_tracker
).
and_return
(
JiraService
.
new
)
visit
namespace_project_path
(
project
.
namespace
,
project
)
expect
(
page
).
to
have_selector
(
".shortcuts-issues"
)
end
end
context
"pipelines subtabs"
do
it
"shows builds when enabled"
do
visit
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
...
...
spec/lib/banzai/reference_parser/external_issue_parser_spec.rb
浏览文件 @
f9963fe0
...
...
@@ -12,7 +12,17 @@ describe Banzai::ReferenceParser::ExternalIssueParser, lib: true do
context
'when the link has a data-issue attribute'
do
before
{
link
[
'data-external-issue'
]
=
123
}
it_behaves_like
"referenced feature visibility"
,
"issues"
levels
=
[
ProjectFeature
::
DISABLED
,
ProjectFeature
::
PRIVATE
,
ProjectFeature
::
ENABLED
]
levels
.
each
do
|
level
|
it
"creates reference when the feature is
#{
level
}
"
do
project
.
project_feature
.
update
(
issues_access_level:
level
)
visible_nodes
=
subject
.
nodes_visible_to_user
(
user
,
[
link
])
expect
(
visible_nodes
).
to
include
(
link
)
end
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录