Skip to content

Commit

Permalink
Merge pull request #5398 from google/bug/5351-hide-goals-cta
Browse files Browse the repository at this point in the history
Bug/5351 - Show goals CTA only if the user is authenticated
  • Loading branch information
techanvil authored Jun 22, 2022
2 parents d540304 + 472972e commit d373e71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ const Overview = ( {
const isSearchConsoleGatheringData = useInViewSelect( ( select ) =>
select( MODULES_SEARCH_CONSOLE ).isGatheringData()
);
const isAuthenticated = useSelect( ( select ) =>
select( CORE_USER ).isAuthenticated()
);

const {
totalClicks,
Expand Down Expand Up @@ -172,6 +175,7 @@ const Overview = ( {
! error );

const showGoalsCTA =
isAuthenticated &&
showAnalytics &&
dashboardType === DASHBOARD_TYPE_MAIN &&
! analyticsGoalsData?.items?.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
provideModuleRegistrations,
provideModules,
provideSiteInfo,
provideUserAuthentication,
provideUserCapabilities,
WithTestRegistry,
} from '../../../../../../../tests/js/utils';
Expand Down Expand Up @@ -258,6 +259,7 @@ export const ReadyWithCreateGoalCTA = Template.bind( {} );
ReadyWithCreateGoalCTA.storyName = 'Ready with Create Goal CTA';
ReadyWithCreateGoalCTA.args = {
setupRegistry: ( registry ) => {
provideUserAuthentication( registry );
provideSearchConsoleMockReport( registry, searchConsoleArgs );
for ( const options of analyticsArgs ) {
provideAnalyticsMockReport( registry, options );
Expand Down

0 comments on commit d373e71

Please sign in to comment.