Skip to content

Commit

Permalink
Check for current user connection instead of connected owner
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeyGuyDylan committed Oct 7, 2024
1 parent 2ef3e4b commit 8eca11d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions projects/plugins/jetpack/extensions/blocks/donations/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Edit = props => {
const blockProps = useBlockProps();
const [ loadingError, setLoadingError ] = useState( '' );
const [ products, setProducts ] = useState( [] );
const { hasConnectedOwner } = useConnection();
const { isUserConnected } = useConnection();

const { lockPostSaving, unlockPostSaving } = useDispatch( 'core/editor' );
const post = useSelect( select => select( 'core/editor' ).getCurrentPost(), [] );
Expand Down Expand Up @@ -137,7 +137,7 @@ const Edit = props => {

let content;

if ( ! hasConnectedOwner ) {
if ( ! isUserConnected ) {
content = (
<ConnectBanner
explanation={ __( 'Connect your WordPress.com account to enable donations.', 'jetpack' ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ALLOWED_BLOCKS = [ 'jetpack/recurring-payments' ];

function PaymentButtonsEdit( { clientId, attributes } ) {
const { layout, fontSize } = attributes;
const { hasConnectedOwner } = useConnection();
const { isUserConnected } = useConnection();
const { connectUrl, isApiConnected } = useSelect( select => {
const { getConnectUrl, isApiStateConnected } = select( membershipProductsStore );
return {
Expand Down Expand Up @@ -76,7 +76,7 @@ function PaymentButtonsEdit( { clientId, attributes } ) {
delete innerBlocksProps.id;
delete innerBlocksProps[ 'data-block' ];

if ( ! hasConnectedOwner ) {
if ( ! isUserConnected ) {
return (
<div { ...blockProps }>
<ConnectBanner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function JetpackPaymentsIntroEdit( { name, clientId } ) {
};
} );

const { hasConnectedOwner } = useConnection();
const { isUserConnected } = useConnection();

const { replaceBlock, selectBlock, updateSettings } = useDispatch( blockEditorStore );

Expand Down Expand Up @@ -71,7 +71,7 @@ export default function JetpackPaymentsIntroEdit( { name, clientId } ) {

let content;

if ( ! hasConnectedOwner ) {
if ( ! isUserConnected ) {
content = (
<ConnectBanner
explanation={ __(
Expand Down
4 changes: 2 additions & 2 deletions projects/plugins/jetpack/extensions/blocks/paywall/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function PaywallEdit() {
const blockProps = useBlockProps();
const postType = useSelect( select => select( editorStore ).getCurrentPostType(), [] );
const accessLevel = useAccessLevel( postType );
const { hasConnectedOwner } = useConnection();
const { isUserConnected } = useConnection();

const { stripeConnectUrl, hasTierPlans } = useSelect( select => {
const { getNewsletterTierProducts, getConnectUrl } = select( 'jetpack/membership-products' );
Expand Down Expand Up @@ -46,7 +46,7 @@ function PaywallEdit() {
setAccess( value );
}

if ( ! hasConnectedOwner ) {
if ( ! isUserConnected ) {
return (
<div { ...blockProps }>
<ConnectBanner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function Edit( { clientId, isSelected, attributes, setAttributes } ) {

const [ selectedTab, selectTab ] = useState( tabs[ WALL_TAB ] );
const blockProps = useBlockProps();
const { hasConnectedOwner } = useConnection();
const { isUserConnected } = useConnection();

const setSelectedProductIds = productIds => setAttributes( { selectedPlanIds: productIds } );

Expand Down Expand Up @@ -102,7 +102,7 @@ function Edit( { clientId, isSelected, attributes, setAttributes } ) {

const isSmallViewport = useViewportMatch( 'medium', '<' );

if ( ! hasConnectedOwner ) {
if ( ! isUserConnected ) {
return (
<div { ...blockProps }>
<ConnectBanner
Expand Down

0 comments on commit 8eca11d

Please sign in to comment.