Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha release Sep 20 #1348

Merged
merged 19 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f75fb21
chore(deps-dev): bump @wordpress/browserslist-config from 6.1.0 to 6.4.0
dependabot[bot] Aug 5, 2024
a94ba92
chore(deps): bump qs from 6.12.1 to 6.13.0
dependabot[bot] Aug 5, 2024
d83952f
chore(deps-dev): bump lint-staged from 15.2.7 to 15.2.8
dependabot[bot] Aug 5, 2024
4e5f716
chore(deps-dev): bump @rushstack/eslint-patch from 1.10.3 to 1.10.4
dependabot[bot] Aug 5, 2024
514f054
chore(deps-dev): bump @wordpress/browserslist-config from 6.4.0 to 6.5.0
dependabot[bot] Aug 12, 2024
4ef5a53
chore(release): merge in release v3.0.0
matticbot Aug 13, 2024
dbb5f76
chore(deps-dev): bump brainmaestro/composer-git-hooks
dependabot[bot] Aug 5, 2024
fee16ae
chore(deps-dev): bump dealerdirect/phpcodesniffer-composer-installer
dependabot[bot] Aug 15, 2024
1a94e71
chore(deps-dev): bump lint-staged from 15.2.8 to 15.2.9
dependabot[bot] Aug 19, 2024
42267f8
chore(deps-dev): bump @wordpress/browserslist-config from 6.5.0 to 6.6.0
dependabot[bot] Aug 26, 2024
21c3091
fix: prioritize ras overlays for delayed prompts
chickenn00dle Aug 29, 2024
c0027d1
fix: prioritize ras overlays for delayed prompts #1341
chickenn00dle Aug 29, 2024
b2ab2f3
chore(deps-dev): bump lint-staged from 15.2.9 to 15.2.10
dependabot[bot] Sep 2, 2024
d5d0ee6
chore(release): merge in release v3.0.1
matticbot Sep 4, 2024
0eb17ff
chore(deps-dev): bump @wordpress/browserslist-config from 6.6.0 to 6.7.0
dependabot[bot] Sep 9, 2024
235f36b
fix: verify delayed prompt can still be displayed before showing (#1344)
chickenn00dle Sep 9, 2024
2c11424
feat: store prompt activation date (#1340)
leogermani Sep 11, 2024
0af2f6a
chore(deps-dev): bump yoast/phpunit-polyfills from 2.0.1 to 3.0.0
dependabot[bot] Sep 9, 2024
9f6f062
fix: check for non-preview logged in user on account criteria (#1347)
miguelpeixe Sep 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"wp-coding-standards/wpcs": "^3.0",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"composer/installers": "^2.0",
"brainmaestro/composer-git-hooks": "^2.8",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"yoast/phpunit-polyfills": "^2.0",
"brainmaestro/composer-git-hooks": "^3.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"yoast/phpunit-polyfills": "^3.0",
"phpunit/phpunit": "^7.0 || ^9.5",
"dms/phpunit-arraysubset-asserts": "^0.5.0"
},
Expand Down
277 changes: 140 additions & 137 deletions composer.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion includes/class-newspack-popups-criteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public static function enqueue_scripts() {
self::SCRIPT_HANDLE,
'newspackPopupsCriteria',
[
'config' => self::get_criteria_config(),
'is_non_preview_user' => is_user_logged_in() && ! Newspack_Popups::is_user_admin(),
'config' => self::get_criteria_config(),
]
);
}
Expand Down
44 changes: 44 additions & 0 deletions includes/class-newspack-popups.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public function __construct() {
add_filter( 'display_post_states', [ __CLASS__, 'display_post_states' ], 10, 2 );
add_action( 'save_post_' . self::NEWSPACK_POPUPS_CPT, [ __CLASS__, 'popup_default_fields' ], 10, 3 );
add_action( 'transition_post_status', [ __CLASS__, 'prevent_default_category_on_publish' ], 10, 3 );
add_action( 'transition_post_status', [ __CLASS__, 'store_activation_dates' ], 10, 3 );
add_action( 'pre_delete_term', [ __CLASS__, 'prevent_default_category_on_term_delete' ], 10, 2 );
add_filter( 'show_admin_bar', [ __CLASS__, 'show_admin_bar' ], 10, 2 ); // phpcs:ignore WordPressVIPMinimum.UserExperience.AdminBarRemoval.RemovalDetected
add_filter( 'newspack_blocks_should_deduplicate', [ __CLASS__, 'newspack_blocks_should_deduplicate' ], 10, 2 );
Expand Down Expand Up @@ -537,6 +538,30 @@ public static function register_meta() {
]
);

\register_meta(
'post',
'activation_date',
[
'object_subtype' => self::NEWSPACK_POPUPS_CPT,
'show_in_rest' => true,
'type' => 'string',
'single' => true,
'auth_callback' => '__return_true',
]
);

\register_meta(
'post',
'deactivation_date',
[
'object_subtype' => self::NEWSPACK_POPUPS_CPT,
'show_in_rest' => true,
'type' => 'string',
'single' => true,
'auth_callback' => '__return_true',
]
);

// Meta field for all post types.
\register_meta(
'post',
Expand Down Expand Up @@ -1020,6 +1045,25 @@ public static function prevent_default_category_on_publish( $new_status, $old_st
}
}

/**
* Stores the activation date of the prompt.
*
* @param string $new_status New status.
* @param string $old_status Old status.
* @param bool $post Post.
*/
public static function store_activation_dates( $new_status, $old_status, $post ) {
if ( self::NEWSPACK_POPUPS_CPT !== $post->post_type ) {
return;
}
if ( 'publish' !== $old_status && 'publish' === $new_status ) {
update_post_meta( $post->ID, 'activation_date', gmdate( 'Y-m-d H:i:s' ) );
}
if ( 'publish' === $old_status && 'publish' !== $new_status ) {
update_post_meta( $post->ID, 'deactivation_date', gmdate( 'Y-m-d H:i:s' ) );
}
}

/**
* When a category is deleted, any posts that have only that category assigned
* are automatically assigned the site's default category (usually "Uncategorized").
Expand Down
Loading