Skip to content

Commit

Permalink
Merge pull request #1154 from Automattic/master
Browse files Browse the repository at this point in the history
Alpha release Jun 22
  • Loading branch information
laurelfulford authored Jun 22, 2023
2 parents f1c10b3 + 05b5f76 commit 6545845
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 32 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"yoast/phpunit-polyfills": "^1.0",
"phpunit/phpunit": "^7.0 || ^9.5",
"dms/phpunit-arraysubset-asserts": "^0.4.0"
"dms/phpunit-arraysubset-asserts": "^0.5.0"
},
"license": "GPL-3.0-or-later",
"scripts": {
Expand Down
43 changes: 21 additions & 22 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion includes/class-newspack-popups-inserter.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,12 @@ private static function is_memberships_restricted( $post_id = null ) {
if ( ! \wc_memberships_is_post_content_restricted( $post_id ) ) {
return false;
}
return ! is_user_logged_in() || ! current_user_can( 'wc_memberships_view_restricted_post_content', $post_id );
$is_restricted = ! is_user_logged_in() || ! current_user_can( 'wc_memberships_view_restricted_post_content', $post_id );
// Detect Content Gate Metering.
if ( $is_restricted && method_exists( 'Newspack\Memberships\Metering', 'is_metering' ) ) {
$is_restricted = ! Newspack\Memberships\Metering::is_metering();
}
return $is_restricted;
}

/**
Expand All @@ -461,6 +466,8 @@ public static function insert_popups_in_content( $content = '' ) {
// Don't inject inline popups on paywalled posts.
// It doesn't make sense with a paywall message and also causes an infinite loop.
|| self::is_memberships_restricted()
// At filter priority 1, $content should be the same as the unfiltered post_content. This guards against inserting in other content such as featured image captions/descriptions.
|| get_post()->post_content !== $content
) {
return $content;
}
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"whatwg-fetch": "^3.6.2"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.3.0",
"@rushstack/eslint-patch": "^1.3.2",
"eslint": "^7.32.0",
"lint-staged": "^13.2.2",
"newspack-scripts": "^5.1.0",
Expand Down

0 comments on commit 6545845

Please sign in to comment.