fix: auto-open RocketCDN banner when clicking dashboard Get RocketCDN button - #8474
fix: auto-open RocketCDN banner when clicking dashboard Get RocketCDN button#8474hellofromahmed wants to merge 3 commits into
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
🟢 Coverage 100.00% diff coverage
Metric Results Coverage variation Report missing for 2072e451 Diff coverage ✅ 100.00% diff coverage (50.00%) Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (2072e45) Report Missing Report Missing Report Missing Head commit (e3ece92) 44282 20311 45.87% Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#8474) 1 1 100.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
@wordpressfan
Full specs can be found here
The dashboard has its own banner that will be expended, with its own views and interactions recorded on Mixpanel. The user shouldn't be moved between pages to see the banner would it be they are on RocketCDN Free or Other CDN. Full specs here |
Description
Fixes #8473
When clicking the "Get RocketCDN" button on the dashboard tab, the user is sent to the CDN tab. Since 3.22, the RocketCDN Pro purchasing banner is collapsed by default (for users with 1–2 free-tier pages). This fix ensures the banner is automatically expanded when navigating from that button.
Type of change
Detailed scenario
What was tested
Manual:
When merging the PR fix: hide RocketCDN billing date for free and non-Pro subscribers (#8447) #8468
For fresh installation without even free rocketcdn subscription:
Another question @DahmaniAdame , when the user uses his own CDN, he still see the button in the dashboard but when clicking on it we go to CDN tab only because the banner itself is in the RocketCDN tab and it's hard to force the user to switch tabs because this will remove his own CDN from being applied in frontend.
How to test
Affected Features & Quality Assurance Scope
Technical description
Documentation
dashboard-status.phprenders the "Get RocketCDN" CTA link (shown when the user has no active paid RocketCDN subscription). Anid="wpr-rocketcdn-dashboard-btn"was added to the link so JS can target it precisely.In
rocketcdn.js, a click handler on#wpr-rocketcdn-dashboard-btn(inside theloadevent, wherebigCTA,ctaToggle, andtoggleBigCTAStateare already in scope) checks whether the purchasing banner (#wpr-rocketcdn-cta) has thewpr-rocketcdn-cta--collapsedclass. If so, it calls the existingtoggleBigCTAState()function which handles expanding the banner, updatingaria-expandedattributes, and firing the Mixpanel tracking event — no duplication of logic.The check prevents double-toggling in cases where the banner is already expanded or hidden.
New dependencies
None.
Risks
Low. The change is purely additive — a new ID attribute on a link and a new click listener. The click handler is guarded by both the element existence check (
if ( dashboardCTABtn )) and the collapsed-state check, so it has no effect if the element is missing or the banner is not in the expected state.Mandatory Checklist
Code validation
Code style
Unticked items justification
Additional Checks