Skip to content

Conversation

@enejb
Copy link
Member

@enejb enejb commented Jul 30, 2025

We are have switched over from the classic admin.

I think we should leave the class and completely remove it in a few version. To give folks that might be calling it chance to migrate to a different code base.

Proposed changes:

  • We have released a new Admin UI for the form responses. This PR removes the call that initializes the classic admin class.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • [xx] Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Does this pull request change what data or activity we track or use?

No

Testing instructions:

Visit the wp-admin.
Does anything break?
Can you export to CSV?
Can you export to Google?
Can you trash, mark as spam feedback?

Try it when you have the classic editor enabled. Does it still work? To add a form?

@enejb enejb requested a review from a team July 30, 2025 04:35
@enejb enejb added [Type] Bug When a feature is broken and / or not performing as intended [Status] Needs Review This PR is ready for review. [Package] Forms labels Jul 30, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 30, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the remove/forms-old-admin branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack remove/forms-old-admin

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Feature] Contact Form [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress labels Jul 30, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 30, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: October 7, 2025
    • Code freeze: October 6, 2025

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control
Copy link

jp-launch-control bot commented Jul 30, 2025

Code Coverage Summary

Coverage changed in 4 files.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/contact-form/class-contact-form-plugin.php 424/1344 (31.55%) -0.92% 38 💔
projects/packages/forms/src/contact-form/class-editor-view.php 0/156 (0.00%) 0.00% -1 💚
projects/packages/forms/src/contact-form/class-util.php 51/180 (28.33%) 7.45% -15 💚
projects/packages/forms/src/contact-form/class-admin.php 0/733 (0.00%) 0.00% -51 💚

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

Copy link
Contributor

@CGastrell CGastrell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It mostly works without hiccups, except on the Google Export. That process is still relying on class-admin::export_to_gdrive.

The issue seems to be the handler is only declared on admin class, as opposed to the CSV export handler that lives on the plugin class.

Gdrive export handler on class-admin:

add_action( 'wp_ajax_grunion_export_to_gdrive', array( $this, 'export_to_gdrive' ) );

CSV export handler on plugin class:

add_action( 'wp_ajax_feedback_export', array( $this, 'download_feedback_as_csv' ) );

@CGastrell CGastrell force-pushed the remove/forms-old-admin branch from e37c0c0 to dbc8b03 Compare September 4, 2025 16:05
@CGastrell CGastrell self-requested a review September 4, 2025 18:50
@enejb enejb marked this pull request as ready for review September 4, 2025 18:51
@enejb enejb requested review from a team and Copilot September 4, 2025 18:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the classic admin initialization call from the forms package as part of transitioning to a new Admin UI for form responses. The classic admin class is being deprecated but left in place for backward compatibility.

  • Removes the Admin::init() call from the forms utility class
  • Moves Google Drive export functionality from the deprecated Admin class to the main Contact_Form_Plugin class
  • Deprecates the classic Admin class while maintaining its interface for backward compatibility

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
projects/plugins/jetpack/changelog/remove-forms-old-admin Changelog entry for the Jetpack plugin
projects/packages/forms/src/contact-form/class-util.php Removes the classic admin initialization call
projects/packages/forms/src/contact-form/class-contact-form-plugin.php Adds Google Drive export functionality and AJAX handler
projects/packages/forms/src/contact-form/class-admin.php Deprecates the class and delegates export functionality
projects/packages/forms/changelog/remove-forms-old-admin Changelog entry for the forms package

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

CGastrell
CGastrell previously approved these changes Sep 4, 2025
Copy link
Contributor

@CGastrell CGastrell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me! I fear those phan failing checks will get us deeper into changes

Copy link
Contributor

@edanzer edanzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a general test of functionality:

  • Admin screens and form inbox, including many different actions
  • Adding and submitting normal form
  • Adding and submitting form with classic editor (I'm surprised this still works)

Beyond that, I tried to go through the methods in this class and be sure that we're not sneakily depending on them elsewhere. I assume @enejb and @CGastrell both did that, and I think you are both more familiar with that class than I am. Sounds like only issue was with export method that we already moved (that also called Admin->get_export_filename, but I see it was updated to use Util::get_export_filename).

I can't see any other issues or functionality in that class that's needed outside the feedback post type page.

For the record, I feel like that file and class were kind of misnamed. I'd think an Admin class would handle lots of general admin logic, but really this is just a file for the feedback post type screen. I guess for a long time that screen WAS the entire admin interface.

if ( is_admin() ) {
add_action( 'wp_ajax_feedback_export', array( $this, 'download_feedback_as_csv' ) );
add_action( 'wp_ajax_create_new_form', array( $this, 'create_new_form' ) );
add_action( 'wp_ajax_grunion_export_to_gdrive', array( $this, 'export_to_gdrive' ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enejb - I saw we moved this one. @CGastrell had also flagged the download_feedback_as_csv method, also tied to ajax actions. Do we need to move and still load that outside of this admin class?

CGastrell
CGastrell previously approved these changes Sep 9, 2025
Copy link
Contributor

@CGastrell CGastrell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the latest commits, still works fine

@CGastrell CGastrell force-pushed the remove/forms-old-admin branch from 6e8d52b to 7d5b379 Compare September 23, 2025 17:50
@CGastrell
Copy link
Contributor

Rebased and re-tested, continues to work well, shall we merge it @enejb ?

@github-actions
Copy link
Contributor

This PR has been marked as stale. This happened because:

  • It has been inactive for the past 3 months.
  • It hasn't been labeled `[Pri] BLOCKER`, `[Pri] High`, `[Status] Keep Open`, etc.

If this PR is still useful, please do a [trunk merge or rebase](https://github.com/Automattic/jetpack/blob/trunk/docs/git-workflow.md#keeping-your-branch-up-to-date) and otherwise make sure it's up to date and has clear testing instructions. You may also want to ping possible reviewers in case they've forgotten about it. Please close this PR if you think it's not valid anymore — if you do, please add a brief explanation.

If the PR is not updated (or at least commented on) in another month, it will be automatically closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Contact Form [Package] Forms [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress [Status] Needs Review This PR is ready for review. [Status] Stale [Tests] Includes Tests [Type] Bug When a feature is broken and / or not performing as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants