-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: check for non-preview logged in user on account criteria
- Loading branch information
1 parent
0af2f6a
commit ca64f98
Showing
2 changed files
with
5 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
/* globals newspackPopupsCriteria */ | ||
import { setMatchingFunction } from '../utils'; | ||
|
||
setMatchingFunction( 'user_account', ( config, { store } ) => { | ||
switch ( config.value ) { | ||
case 'with-account': | ||
return store.get( 'reader' )?.email; | ||
return newspackPopupsCriteria.is_non_preview_user || store.get( 'reader' )?.email; | ||
case 'without-account': | ||
return ! store.get( 'reader' )?.email; | ||
return ! newspackPopupsCriteria.is_non_preview_user && ! store.get( 'reader' )?.email; | ||
} | ||
} ); |