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
bd13066a
Commit
bd13066a
authored
Mar 09, 2020
by
Aakriti Gupta
Committed by
Dmytro Zaporozhets
Mar 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add visibility helper for Group Activity feature
parent
908902d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
ee/app/helpers/ee/groups_helper.rb
ee/app/helpers/ee/groups_helper.rb
+8
-0
ee/spec/helpers/ee/groups_helper_spec.rb
ee/spec/helpers/ee/groups_helper_spec.rb
+33
-0
No files found.
ee/app/helpers/ee/groups_helper.rb
View file @
bd13066a
...
@@ -93,6 +93,14 @@ module EE
...
@@ -93,6 +93,14 @@ module EE
current_user
.
ab_feature_enabled?
(
:discover_security
)
current_user
.
ab_feature_enabled?
(
:discover_security
)
end
end
def
show_group_activity_analytics?
return
false
unless
@group
.
feature_available?
(
:group_activity_analytics
)
return
false
unless
can?
(
current_user
,
:read_group_activity_analytics
,
@group
)
true
end
private
private
def
get_group_sidebar_links
def
get_group_sidebar_links
...
...
ee/spec/helpers/ee/groups_helper_spec.rb
View file @
bd13066a
...
@@ -138,4 +138,37 @@ describe GroupsHelper do
...
@@ -138,4 +138,37 @@ describe GroupsHelper do
end
end
end
end
end
end
describe
'#show_group_activity_analytics?'
do
before
do
stub_licensed_features
(
group_activity_analytics:
feature_available
)
allow
(
helper
).
to
receive
(
:current_user
)
{
current_user
}
allow
(
helper
).
to
receive
(
:can?
)
{
|*
args
|
Ability
.
allowed?
(
*
args
)
}
end
context
'when feature is not available for group'
do
let
(
:feature_available
)
{
false
}
it
'returns false'
do
expect
(
helper
.
show_group_activity_analytics?
).
to
be
false
end
end
context
'when current user does not have access to the group'
do
let
(
:feature_available
)
{
true
}
let
(
:current_user
)
{
create
(
:user
)
}
it
'returns false'
do
expect
(
helper
.
show_group_activity_analytics?
).
to
be
false
end
end
context
'when feature is available and user has access to it'
do
let
(
:feature_available
)
{
true
}
it
'returns true'
do
expect
(
helper
.
show_group_activity_analytics?
).
to
be
true
end
end
end
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