Skip to content

Commit

Permalink
Stats: Prevent visiting the gated period views (#97687)
Browse files Browse the repository at this point in the history
  • Loading branch information
dognose24 authored Dec 23, 2024
1 parent 2d92082 commit 01c2803
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/my-sites/stats/site.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,15 @@ class StatsSite extends Component {

customChartRange.daysInRange = daysInRange;

// Redirect to the daily views if the period dropdown is locked.
if ( shouldForceDefaultPeriod && period !== 'day' ) {
page.redirect( `/stats/day/${ slug }${ window.location.search }` );
return;
}

// TODO: all the date logic should be done in controllers, otherwise it affects the performance.
// If it's single day period, redirect to hourly stats.
if ( period === 'day' && daysInRange === 1 ) {
if ( ! shouldForceDefaultPeriod && period === 'day' && daysInRange === 1 ) {
page.redirect( `/stats/hour/${ slug }${ window.location.search }` );
return;
}
Expand Down

0 comments on commit 01c2803

Please sign in to comment.