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
98ec4b86
Commit
98ec4b86
authored
Aug 24, 2020
by
mfluharty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also check for group coverage reports feature flag
Repository analytics has only group coverage reports for now
parent
74115b2d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
2 deletions
+14
-2
ee/app/controllers/groups/analytics/repository_analytics_controller.rb
...llers/groups/analytics/repository_analytics_controller.rb
+2
-1
ee/app/helpers/ee/analytics/navbar_helper.rb
ee/app/helpers/ee/analytics/navbar_helper.rb
+1
-0
ee/config/routes/group.rb
ee/config/routes/group.rb
+1
-1
ee/spec/controllers/groups/analytics/repository_analytics_controller_spec.rb
.../groups/analytics/repository_analytics_controller_spec.rb
+10
-0
No files found.
ee/app/controllers/groups/analytics/repository_analytics_controller.rb
View file @
98ec4b86
# frozen_string_literal: true
class
Groups::Analytics::RepositoryAnalyticsController
<
Groups
::
Analytics
::
ApplicationController
check_feature_flag
Gitlab
::
Analytics
::
GROUP_COVERAGE_REPORTS_FEATURE_FLAG
layout
'group'
before_action
:load_group
before_action
->
{
check_feature_availability!
(
:group_coverage_reports
)
}
before_action
->
{
check_feature_availability!
(
:group_repository_analytics
)
}
before_action
->
{
authorize_view_by_action!
(
:read_group_repository_analytics
)
}
...
...
ee/app/helpers/ee/analytics/navbar_helper.rb
View file @
98ec4b86
...
...
@@ -137,6 +137,7 @@ module EE
end
def
group_repository_analytics_navbar_link
(
group
,
current_user
)
return
unless
::
Gitlab
::
Analytics
.
group_coverage_reports_enabled?
return
unless
group_sidebar_link?
(
:repository_analytics
)
navbar_sub_item
(
...
...
ee/config/routes/group.rb
View file @
98ec4b86
...
...
@@ -26,7 +26,7 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
resource
:productivity_analytics
,
only: :show
,
constraints:
->
(
req
)
{
Gitlab
::
Analytics
.
productivity_analytics_enabled?
}
resources
:coverage_reports
,
only: :index
,
constraints:
->
(
req
)
{
Gitlab
::
Analytics
.
group_coverage_reports_enabled?
}
resource
:merge_request_analytics
,
only: :show
,
constraints:
->
(
req
)
{
Gitlab
::
Analytics
.
group_merge_request_analytics_enabled?
}
resource
:repository_analytics
,
only:
[
:show
]
resource
:repository_analytics
,
only:
:show
,
constraints:
->
(
req
)
{
Gitlab
::
Analytics
.
group_coverage_reports_enabled?
}
feature_default_enabled
=
Gitlab
::
Analytics
.
feature_enabled_by_default?
(
Gitlab
::
Analytics
::
CYCLE_ANALYTICS_FEATURE_FLAG
)
constrainer
=
::
Constraints
::
FeatureConstrainer
.
new
(
Gitlab
::
Analytics
::
CYCLE_ANALYTICS_FEATURE_FLAG
,
default_enabled:
feature_default_enabled
)
...
...
ee/spec/controllers/groups/analytics/repository_analytics_controller_spec.rb
View file @
98ec4b86
...
...
@@ -5,11 +5,13 @@ require 'spec_helper'
RSpec
.
describe
Groups
::
Analytics
::
RepositoryAnalyticsController
do
let_it_be
(
:current_user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
:group
}
let_it_be
(
:feature_flag_name
)
{
Gitlab
::
Analytics
::
GROUP_COVERAGE_REPORTS_FEATURE_FLAG
}
let_it_be
(
:feature_name
)
{
:group_repository_analytics
}
before
do
sign_in
(
current_user
)
stub_feature_flags
(
feature_flag_name
=>
true
)
stub_licensed_features
(
feature_name
=>
true
)
end
...
...
@@ -30,6 +32,14 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do
it
{
is_expected
.
to
have_gitlab_http_status
(
:forbidden
)
}
end
context
'when feature flag is off'
do
before
do
stub_feature_flags
(
feature_flag_name
=>
false
)
end
it
{
is_expected
.
to
have_gitlab_http_status
(
:not_found
)
}
end
context
'when the user has no access to the group'
do
before
do
current_user
.
group_members
.
delete_all
...
...
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