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
0135802c
Commit
0135802c
authored
Apr 13, 2022
by
Serena Fang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move namespace helper method to ee
parent
96cf6f50
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
48 deletions
+48
-48
app/helpers/namespaces_helper.rb
app/helpers/namespaces_helper.rb
+0
-6
ee/app/helpers/ee/namespaces_helper.rb
ee/app/helpers/ee/namespaces_helper.rb
+6
-0
ee/spec/helpers/ee/namespaces_helper_spec.rb
ee/spec/helpers/ee/namespaces_helper_spec.rb
+42
-0
spec/helpers/namespaces_helper_spec.rb
spec/helpers/namespaces_helper_spec.rb
+0
-42
No files found.
app/helpers/namespaces_helper.rb
View file @
0135802c
...
...
@@ -88,12 +88,6 @@ module NamespacesHelper
}.
to_json
end
def
show_minute_limit_banner?
(
namespace
)
return
false
unless
Gitlab
.
com?
&&
::
Feature
.
enabled?
(
:show_minute_limit_banner
)
namespace
.
root_ancestor
.
free_plan?
&&
!
minute_limit_banner_dismissed?
?
true
:
false
end
private
# Many importers create a temporary Group, so use the real
...
...
ee/app/helpers/ee/namespaces_helper.rb
View file @
0135802c
...
...
@@ -61,6 +61,12 @@ module EE
buy_storage_subscriptions_url
(
selected_group:
namespace
.
id
)
end
def
show_minute_limit_banner?
(
namespace
)
return
false
unless
::
Gitlab
.
com?
&&
::
Feature
.
enabled?
(
:show_minute_limit_banner
)
namespace
.
root_ancestor
.
free_plan?
&&
!
minute_limit_banner_dismissed?
?
true
:
false
end
private
def
use_customers_dot_for_addon_path?
(
namespace
)
...
...
ee/spec/helpers/ee/namespaces_helper_spec.rb
View file @
0135802c
...
...
@@ -222,4 +222,46 @@ RSpec.describe EE::NamespacesHelper do
end
end
end
describe
'#show_minute_limit_banner?'
do
let
(
:project
)
{
create
(
:project
)
}
context
'on dot com'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:feature_flag_enabled
,
:free_project
,
:user_dismissed_banner
,
:should_show_banner
)
do
true
|
true
|
false
|
true
true
|
true
|
true
|
false
true
|
false
|
false
|
false
false
|
true
|
false
|
false
end
with_them
do
before
do
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
stub_feature_flags
(
show_minute_limit_banner:
feature_flag_enabled
)
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
free_project
)
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
'minute_limit_banner'
).
and_return
(
user_dismissed_banner
)
end
it
'shows the banner if required'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
should_show_banner
)
end
end
end
context
'not dot com'
do
context
'when feature flag is enabled for a free project and user has not dismissed callout'
do
before
do
stub_feature_flags
(
show_minute_limit_banner:
true
)
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
true
)
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
'minute_limit_banner'
).
and_return
(
false
)
end
it
'does not show banner'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
false
)
end
end
end
end
end
spec/helpers/namespaces_helper_spec.rb
View file @
0135802c
...
...
@@ -268,46 +268,4 @@ RSpec.describe NamespacesHelper do
end
end
end
describe
'#show_minute_limit_banner?'
do
let
(
:project
)
{
create
(
:project
)
}
context
'on dot com'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:feature_flag_enabled
,
:free_project
,
:user_dismissed_banner
,
:should_show_banner
)
do
true
|
true
|
false
|
true
true
|
true
|
true
|
false
true
|
false
|
false
|
false
false
|
true
|
false
|
false
end
with_them
do
before
do
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
stub_feature_flags
(
show_minute_limit_banner:
feature_flag_enabled
)
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
free_project
)
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
Users
::
CalloutsHelper
::
MINUTE_LIMIT_BANNER
).
and_return
(
user_dismissed_banner
)
end
it
'shows the banner if required'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
should_show_banner
)
end
end
end
context
'not dot com'
do
context
'when feature flag is enabled for a free project and user has not dismissed callout'
do
before
do
stub_feature_flags
(
show_minute_limit_banner:
true
)
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
true
)
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
Users
::
CalloutsHelper
::
MINUTE_LIMIT_BANNER
).
and_return
(
false
)
end
it
'does not show banner'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
false
)
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