Fix expiring subscription message on subgroups
What does this MR do?
As discussed in #331459 (closed), when a user visits a sub-group that is within the hierarchy of a namespace that has an expiring subscription, they currently see the expiring subscription banner even if the root namespace has already purchased a renewal ("future dated renewal").
This MR fixes that by modifying the method being used from namespace#gitlab_subscription
to namespace#closest_gitlab_subscription
when checking if a subscription exists at all.
This means that we now check for future dated renewals when viewing an applicable sub-group, whereas before it would just assume no future renewal and always render the banner.
Testing
Testing this can be a little tricky unless you have a working CustomersDot setup (installation docs), or already have a group with a subscription with a future renewal.
If/once you have CustomersDot setup:
- add a subscription to a namespace
- renew that subscription so that it has a future dated renewal
- (skip to here if you already have the correct data setup) modify your current GitLab subscription to have an end date in the near future, i.e. considered expiring, and not set to auto-renew:
GitlabSubscription.last.update(end_date: Date.today + 10.days, auto_renew: false)
You'll also need the feature flag relating to this service enabled:
Feature.enable(:gitlab_subscription_future_renewal)
- navigate to your root namespace and you should not see an expiry message due to the future renewal being in place
- navigate to your sub group and you should also not see the expiry message (
👈🏽 this is what this MR resolves)
Screenshots
Before this MR | After this MR |
---|---|
![]() |
![]() |
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.