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
0067aaa2
Commit
0067aaa2
authored
Mar 14, 2022
by
Doug Stull
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove closest_gitlab_subscription in favor of root_ancestor
- logic is being duplicated and is memoized already.
parent
1bb6a4ab
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
8 additions
and
72 deletions
+8
-72
ee/app/helpers/ee/subscribable_banner_helper.rb
ee/app/helpers/ee/subscribable_banner_helper.rb
+1
-1
ee/app/models/ee/namespace.rb
ee/app/models/ee/namespace.rb
+0
-10
ee/app/models/ee/namespace/root_storage_size.rb
ee/app/models/ee/namespace/root_storage_size.rb
+3
-3
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+0
-1
ee/lib/gitlab/expiring_subscription_message.rb
ee/lib/gitlab/expiring_subscription_message.rb
+1
-1
ee/spec/helpers/ee/subscribable_banner_helper_spec.rb
ee/spec/helpers/ee/subscribable_banner_helper_spec.rb
+3
-2
ee/spec/models/ee/namespace_spec.rb
ee/spec/models/ee/namespace_spec.rb
+0
-52
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+0
-2
No files found.
ee/app/helpers/ee/subscribable_banner_helper.rb
View file @
0067aaa2
...
...
@@ -65,7 +65,7 @@ module EE
entity
=
@project
||
@group
return
unless
entity
&&
entity
.
persisted?
subscription
=
entity
.
closest_
gitlab_subscription
subscription
=
entity
.
root_ancestor
.
gitlab_subscription
return
unless
subscription
...
...
ee/app/models/ee/namespace.rb
View file @
0067aaa2
...
...
@@ -211,16 +211,6 @@ module EE
end
end
def
closest_gitlab_subscription
strong_memoize
(
:closest_gitlab_subscription
)
do
if
parent_id
root_ancestor
.
gitlab_subscription
else
gitlab_subscription
end
end
end
def
plan_name_for_upgrading
return
::
Plan
::
FREE
if
trial_active?
...
...
ee/app/models/ee/namespace/root_storage_size.rb
View file @
0067aaa2
...
...
@@ -41,15 +41,15 @@ module EE
def
enforce_limit?
return
false
if
Date
.
current
<
ENFORCEMENT_DATE
return
true
unless
closest_
gitlab_subscription
&
.
has_a_paid_hosted_plan?
return
true
unless
gitlab_subscription
&
.
has_a_paid_hosted_plan?
closest_
gitlab_subscription
.
start_date
>=
EFFECTIVE_DATE
gitlab_subscription
.
start_date
>=
EFFECTIVE_DATE
end
private
attr_reader
:root_namespace
delegate
:
closest_
gitlab_subscription
,
to: :root_namespace
delegate
:gitlab_subscription
,
to: :root_namespace
end
end
ee/app/models/ee/project.rb
View file @
0067aaa2
...
...
@@ -198,7 +198,6 @@ module EE
delegate
:merge_trains_enabled
,
:merge_trains_enabled
=
,
to: :ci_cd_settings
,
allow_nil:
true
delegate
:auto_rollback_enabled
,
:auto_rollback_enabled
=
,
to: :ci_cd_settings
,
allow_nil:
true
delegate
:closest_gitlab_subscription
,
to: :namespace
delegate
:requirements_access_level
,
to: :project_feature
,
allow_nil:
true
delegate
:pipeline_configuration_full_path
,
to: :compliance_management_framework
,
allow_nil:
true
...
...
ee/lib/gitlab/expiring_subscription_message.rb
View file @
0067aaa2
...
...
@@ -129,7 +129,7 @@ module Gitlab
end
def
subscription_future_renewal?
return
if
self_managed?
||
namespace
.
nil?
||
!
namespace
.
closest_
gitlab_subscription
.
present?
return
if
self_managed?
||
namespace
.
nil?
||
!
namespace
.
root_ancestor
.
gitlab_subscription
.
present?
::
GitlabSubscriptions
::
CheckFutureRenewalService
.
new
(
namespace:
namespace
).
execute
end
...
...
ee/spec/helpers/ee/subscribable_banner_helper_spec.rb
View file @
0067aaa2
...
...
@@ -23,9 +23,10 @@ RSpec.describe EE::SubscribableBannerHelper, :saas do
shared_examples
'when a subscription exists'
do
let
(
:gitlab_subscription
)
{
build_stubbed
(
:gitlab_subscription
)
}
let
(
:root_ancestor
)
{
entity
.
root_ancestor
}
it
'returns a decorator'
do
allow
(
entity
).
to
receive
(
:closest_
gitlab_subscription
).
and_return
(
gitlab_subscription
)
allow
(
root_ancestor
).
to
receive
(
:
gitlab_subscription
).
and_return
(
gitlab_subscription
)
expect
(
subject
).
to
be_a
(
SubscriptionPresenter
)
end
...
...
@@ -117,7 +118,7 @@ RSpec.describe EE::SubscribableBannerHelper, :saas do
allow
(
::
Gitlab
::
CurrentSettings
).
to
receive
(
:should_check_namespace_plan?
).
and_return
(
true
)
end
let
(
:gitlab_subscription
)
{
entity
.
closest_
gitlab_subscription
}
let
(
:gitlab_subscription
)
{
entity
.
root_ancestor
.
gitlab_subscription
}
let
(
:decorated_mock
)
{
double
(
:decorated_mock
)
}
let
(
:message_mock
)
{
double
(
:message_mock
)
}
let
(
:user
)
{
double
(
:user_mock
)
}
...
...
ee/spec/models/ee/namespace_spec.rb
View file @
0067aaa2
...
...
@@ -2119,58 +2119,6 @@ RSpec.describe Namespace do
end
end
describe
'#closest_gitlab_subscription'
,
:saas
do
subject
{
group
.
closest_gitlab_subscription
}
context
'when there is a root ancestor'
do
let
(
:group
)
{
create
(
:group
,
parent:
root
)
}
context
'when root has a subscription'
do
let
(
:root
)
{
create
(
:group_with_plan
)
}
it
{
is_expected
.
to
be_a
(
GitlabSubscription
)
}
end
context
'when root has no subscription'
do
let
(
:root
)
{
create
(
:group
)
}
it
{
is_expected
.
to
be_nil
}
end
end
context
'when there is no root ancestor'
do
context
'for groups'
do
context
'has a subscription'
do
let
(
:group
)
{
create
(
:group_with_plan
)
}
it
{
is_expected
.
to
be_a
(
GitlabSubscription
)
}
end
context
'it has no subscription'
do
let
(
:group
)
{
create
(
:group
)
}
it
{
is_expected
.
to
be_nil
}
end
end
context
'for personal namespaces'
do
subject
{
namespace
.
closest_gitlab_subscription
}
context
'has a subscription'
do
let
(
:namespace
)
{
create
(
:namespace_with_plan
)
}
it
{
is_expected
.
to
be_a
(
GitlabSubscription
)
}
end
context
'it has no subscription'
do
let
(
:namespace
)
{
create
(
:namespace
)
}
it
{
is_expected
.
to
be_nil
}
end
end
end
end
describe
'#namespace_limit'
do
let
(
:group
)
{
create
(
:group
,
parent:
parent
)
}
...
...
ee/spec/models/project_spec.rb
View file @
0067aaa2
...
...
@@ -15,8 +15,6 @@ RSpec.describe Project do
it
{
is_expected
.
to
delegate_method
(
:ci_minutes_quota
).
to
(
:shared_runners_limit_namespace
)
}
it
{
is_expected
.
to
delegate_method
(
:shared_runners_minutes_limit_enabled?
).
to
(
:shared_runners_limit_namespace
)
}
it
{
is_expected
.
to
delegate_method
(
:closest_gitlab_subscription
).
to
(
:namespace
)
}
it
{
is_expected
.
to
delegate_method
(
:pipeline_configuration_full_path
).
to
(
:compliance_management_framework
)
}
it
{
is_expected
.
to
delegate_method
(
:prevent_merge_without_jira_issue
).
to
(
:project_setting
)
}
...
...
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