update the active_add_on_purchase check to include self-managed check
What does this MR do and why?
https://gitlab.com/gitlab-com/request-for-help/-/issues/3209
for self-managed instance the namespace id in AddOnPurchase table is nil which caused the check fail:
::GitlabSubscriptions::AddOnPurchase
.joins(:add_on)
.where(
namespace_id: self_and_ancestor_ids,
subscription_add_ons: { name: GitlabSubscriptions::AddOn.names[add_on] }
)
.active
.any?
in this MR I added the check for self-managed instance
References
Screenshots or screen recordings
| Before | After |
|---|---|
::Gitlab.com? => false (sm deploy)
# make sure there's a add-on purchase namespace_id: nil (sm deploy)and
# subscription_add_on_id: 3 (duo_enterprise add on) and
# updated_at: Wed, 06 Aug 2025 15:50:26.057244000 UTC +00:00 (valid)
<GitlabSubscriptions::AddOnPurchase:0x0000000169cdd498 id: 1, created_at: Tue, 22 Apr 2025 19:00:00.917180000 UTC +00:00, updated_at: Wed, 06 Aug 2025 15:50:26.057244000 UTC +00:00, subscription_add_on_id: 3, namespace_id: nil, quantity: 100, expires_on: Fri, 15 Aug 2025, purchase_xid: "C-00769226", last_assigned_users_refreshed_at: Tue, 05 Aug 2025 12:00:09.694861000 UTC +00:00, trial: false, started_at: Tue, 10 Sep 2024, organization_id: 1>]
in merge request setting page:
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #3209 (closed)
Edited by Tian Gao
