Skip to content

Commit e7691ad

Browse files
CGastrellmatticbot
authored andcommitted
Jetpack Forms: cleanup dashboard migration code (#43825)
* remove TODOs and code from legaacy view requests * changelog * remove all now unused view switch methods * assume first 3 filters for the migration are now active, remove wrapped conditional code * update docblock, add note on how to handle polldaddy interaction * remove force param on get_forms_admin_url and append_tab_to_url as we don't offer classic view anymore * update phan baseline for forms * update phan baseline * fixes after rebase * update tests * update phan baselines Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/20957059136 Upstream-Ref: Automattic/jetpack@3ba0640
1 parent 4da51e3 commit e7691ad

File tree

7 files changed

+149
-498
lines changed

7 files changed

+149
-498
lines changed

jetpack_vendor/automattic/jetpack-forms/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ This is an alpha version! The changes listed here are not final.
1616
### Changed
1717
- Update package dependencies.
1818

19+
### Removed
20+
- Forms: clean up all dashboard migration code (filters, methods and wrapped up code)
21+
1922
### Fixed
2023
- Consent block: automatically set required to false when consent type is implicit
2124
- Forms: fix dashboard routing on wpcom.

jetpack_vendor/automattic/jetpack-forms/src/contact-form/class-contact-form-plugin.php

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,9 @@ public static function gutenblock_render_field_image_select( $atts, $content, $b
14261426
public function admin_menu() {
14271427
$slug = 'feedback';
14281428

1429-
if ( is_plugin_active( 'polldaddy/polldaddy.php' ) ) {
1429+
// Do we still need to create the Feedback menu item for polldaddy?
1430+
// WPCOM already handles this. Self hosted will depend on us until we produce a new release for polldaddy.
1431+
if ( is_plugin_active( 'polldaddy/polldaddy.php' ) || ! Jetpack_Forms::is_legacy_menu_item_retired() ) {
14301432
add_menu_page(
14311433
__( 'Feedback', 'jetpack-forms' ),
14321434
__( 'Feedback', 'jetpack-forms' ),
@@ -1517,22 +1519,6 @@ public function unread_count() {
15171519
}
15181520
return;
15191521
}
1520-
1521-
if ( isset( $submenu['feedback'] ) && is_array( $submenu['feedback'] ) && ! empty( $submenu['feedback'] ) ) {
1522-
foreach ( $submenu['feedback'] as $index => $menu_item ) {
1523-
if ( 'edit.php?post_type=feedback' === $menu_item[2] ) {
1524-
$unread = self::get_unread_count();
1525-
1526-
if ( $unread > 0 ) {
1527-
$unread_count = current_user_can( 'publish_pages' ) ? " <span class='feedback-unread jp-feedback-unread-counter count-{$unread} awaiting-mod'><span class='feedback-unread-count'>" . number_format_i18n( $unread ) . '</span></span>' : '';
1528-
1529-
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
1530-
$submenu['feedback'][ $index ][0] .= $unread_count;
1531-
}
1532-
break;
1533-
}
1534-
}
1535-
}
15361522
}
15371523

15381524
/**
@@ -3020,15 +3006,6 @@ public function get_feedback_entries_from_post() {
30203006
$args['s'] = sanitize_text_field( wp_unslash( $_POST['search'] ) );
30213007
}
30223008

3023-
// TODO: We can remove this when the wp-admin UI is removed.
3024-
if ( ! empty( $_POST['year'] ) && intval( $_POST['year'] ) > 0 ) {
3025-
$args['date_query']['year'] = intval( $_POST['year'] );
3026-
}
3027-
// TODO: We can remove this when the wp-admin UI is removed.
3028-
if ( ! empty( $_POST['month'] ) && intval( $_POST['month'] ) > 0 ) {
3029-
$args['date_query']['month'] = intval( $_POST['month'] );
3030-
}
3031-
30323009
if ( ! empty( $_POST['after'] ) && ! empty( $_POST['before'] ) ) {
30333010
$before = strtotime( sanitize_text_field( wp_unslash( $_POST['before'] ) ) );
30343011
$after = strtotime( sanitize_text_field( wp_unslash( $_POST['after'] ) ) );

0 commit comments

Comments
 (0)