Fix product analytics state when addon is not purchased
What does this MR do and why?
This MR fixes a bug that occurs when
- Product analytics onboarding is completed before
-
product_analytics_billing
is enabled - Customer did not purchase the add on
- Customer visits the product analytics dashboards page
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
When FF is disabled
No visual change
When FF is enabled
Before
After
When | Screenshot |
---|---|
Customer sees set up button | |
Setup button takes to onboarding page | |
After customer buys the addon |
How to set up and validate locally
- Disable the feature flag
Feature.disable(:product_analytics_billing, namespace, type: :wip)
- Set up product analytics
- Visit dashboards page
http://gdk.test:3000/namespace/project/-/analytics/dashboards
- You should be able to see product analytics dashboards
- Enable the feature flag
Feature.enable(:product_analytics_billing, namespace, type: :wip)
- Visit same dashboards page
http://gdk.test:3000/namespace/project/-/analytics/dashboards
- You should not see dashboards but see a Set up button
- Clicking set up button should show Sales CTA
- Create an add on
a = GitlabSubscriptions::AddOn.new(description: "Product analytics", name = 2)
a.save
p = GitlabSubscriptions::AddOnPurchase.new(namespace: group, expires_on: 1.year.from_now.to_date, quantity: 1, purchase_xid: SecureRandom.hex(16), subscription_add_on_id: a.id)
p.save
- Visit same dashboards page
http://gdk.test:3000/namespace/project/-/analytics/dashboards
- You should be able to see product analytics dashboards
Edited by Halil Coban