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

Add new external media endpoint #40145

Closed
wants to merge 52 commits into from
Closed

Conversation

zaerl
Copy link
Contributor

@zaerl zaerl commented Nov 12, 2024

Fixes #40038, endpoint part

Proposed changes:

  • Add new Google Picker WPCOM endpoints to Jetpack

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?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

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

Testing instructions:

The flow should be the same as of WoA sites with features on.
image

@zaerl zaerl self-assigned this Nov 12, 2024
@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress labels Nov 12, 2024
Copy link
Contributor

github-actions bot commented Nov 12, 2024

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 WordPress.com Simple 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, and enable the add/new-external-media-endpoint branch.

    • For jetpack-mu-wpcom changes, also add define( 'JETPACK_MU_WPCOM_LOAD_VIA_BETA_PLUGIN', true ); to your wp-config.php file.
  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack add/new-external-media-endpoint
    
    bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/new-external-media-endpoint
    

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

Copy link
Contributor

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 Team Review, ...).
  • ✅ 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 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? 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 semi-continuously (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for none scheduled (scheduled code freeze on undefined).

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

Initsogar and others added 10 commits November 12, 2024 11:39
* Set up react-query, moment and typescript

* changelog

* Add endpoint to fetch site backup schedule time

* Setup react-query (queryClientProvider)

* Add useScheduledTimeQuery hook to fetch schedule time

* Add hook to parse and return the next backup schedule time

* Add component to render the next scheduled backup message

* Fix record Tracks event

* Removing changelog for migration and core plugin

* Bump `Automattic\Jetpack\Backup` namespace to V0005

* changelog

* Bump `Automattic\Jetpack\Transport_Helper` to V0005

* Remove `between` to make `Modify` fit in the same line

* Fix pnpm lock
* Repo Gardening: allow escalating issues to multiple groups

Up until now, once we had sent one Slack notification about an issue, we couldn't send another to a different team. This was problematic given that we attempt to warn about escalated issues to 2 different teams:

- Product Ambassador HEs in the Triage Issues task
- Dev teams in the Update Board task

By splitting things into 2 different labels ("[Status] Priority Review Triggered" for dev teams, "[Status] Escalated to Product Ambassadors" for Product ambassadors), we can now send notifications to two different teams.

It is not the perfect solution since ideally, we'd want to allow notifications per Slack channel instead of per team, but:

- There is currently no better way to warn about an issue already escalated than to add a label.
- We cannot really use the Slack channel ID in the label name, that would be odd.

* Simplify check before we send slack notification

This was added in #30100, but it ends up blocking legitimate messages from being sent.

* Move checking for labels out of the Slack notification function

This should be handled by each task calling the function, for more flexibility, and a simpler notification function.

* Remove Update Board task

We'll merge it into the existing triage issues task. It is not very intuitive to have this being two different tasks, when both perform actions that can be described as issue triage. It also makes the codebase more approachable, and will allow us to extract / centralize some of the logic that was used in both tasks.

* Extract more label detection functions

* Extract AI labeling into its own file

It should make it a bit easier for folks to contribute.

* Add new Project board management "sub-task" for triageIssues

* Document the new actions performed by the Triage issues task

* Extract method used to find the priority of an issue

* Bring it all together in the update triageIssues task

* Fix argument order

* Add missing argument

* Remove unnecessary state check (we check earlier) & add logging

* Remove files that are no longer used

* Add label when issue is automatically triaged to project board

See pfVjQF-55-p2#comment-119

* Update label name

See pfVjQF-55-p2#comment-127

* Switch to major version bump

See #39973 (comment)

* Update to new label value format

See #39973 (comment)

* Simplify check for existing labels on issues

See #39973 (comment)

This is similar to what was already done in 148b28c

* Better clarify where issue priority comes from, and use it

Let's not attempt to add a label to an issue when it is already on the issue.

See #39973 (comment)
* Bump minimum WP version to 6.6

* Match WP tested version to readme

* Add changelogs

* Remove 7.0 tests

* Update comments with more recent data

* Update composer.lock

* Fix comment
…ess blue (#39966)

* Update color on WP.com coming soon banner

---------

Co-authored-by: Kateryna Kodonenko <[email protected]>
Co-authored-by: Brandon Kraft <[email protected]>
…AI Assistant (#40148)

* Jatpack AI: Adding "transform list into table" functionality back to AI Assistant

* changelog
)

See pdqkMK-1lq-p2#comment-1657

We now want to trigger AI Labelling for all newly opened issues, as long as they do not have the "[Type] Task" label (since those are typically created for projects). We do not require a custom label anymore.
* Additional CSS: Update the upgrade nudge with the correct plan

* Add translators comment and docblock.

* Use FQCN

* Fix broken test

* Fix tests

* Mock method for the Atomic test

* Fix test and linting.

* Update assert

* Update tests and fix linting.

* Linting.

* Disable deprecation for setMethods.
@zaerl zaerl requested review from ouikhuan and bogiii November 13, 2024 12:48
CGastrell and others added 11 commits November 13, 2024 10:19
* adapt guessStyle to recieve request type and pass down contextual content

* append revised_prompt to image promise response

* add initialPrompt and initialStyle for AI modal component, cleanup dependencies on hooks

* only allow style guessing if handler is provided

* add effect to be able to update prompt from props

* add style parameter and adjust autostart handler to guess style on first generation. Fix all sort of shenanigans with typescript linter

* changelog

* pass down post title for context

* add minPromptLength to validate/toggle button on prompt

* fix a problem with contentEditable elements where browsers will add a default <br> when empty, hence preventing our data-placeholder to show up on seemingly empty input

* allow ai modal to pass down minPromptLength validation

* fix wrong parameter name for userPrompt

* do not allow generation if post and prompt are empty
* Repo Gardening: cover more use-cases of changelog files

We should avoid adding a "Docs" label when a changelog.md file is modified, even if that file name does not use uppercase, or if that file is at the root of the repo.

* Update projects/github-actions/repo-gardening/src/tasks/add-labels/index.js

Co-authored-by: Brad Jorsch <[email protected]>

---------

Co-authored-by: Brad Jorsch <[email protected]>
If the PR has no PHP and/or JS coverage data, the `process-coverage.sh`
script should do the right thing instead of failing.
* Jetpack Sync: Add 'od_url_metrics' in blacklisted post types
* Bump minimum WP version to 6.6

* Match WP tested version to readme

* Add changelogs

* Remove 7.0 tests

* Update comments with more recent data

* Update composer.lock

* Fix comment

* Backup: Add next daily backup schedule time (#39914)

* Set up react-query, moment and typescript

* changelog

* Add endpoint to fetch site backup schedule time

* Setup react-query (queryClientProvider)

* Add useScheduledTimeQuery hook to fetch schedule time

* Add hook to parse and return the next backup schedule time

* Add component to render the next scheduled backup message

* Fix record Tracks event

* Removing changelog for migration and core plugin

* Bump `Automattic\Jetpack\Backup` namespace to V0005

* changelog

* Bump `Automattic\Jetpack\Transport_Helper` to V0005

* Remove `between` to make `Modify` fit in the same line

* Fix pnpm lock

* Bump PHP 7.0 refs

* Clean up false positive

* setMethods → onlyMethods

* Add changelogs

* Bump PHP 7.0 refs

* Clean up false positive

* setMethods → onlyMethods

* Add changelogs

* More changelogs

* Remove suppression for old PHP versions

* Make PHPCS and Phan rules match

* Docs tweak

Co-authored-by: Brad Jorsch <[email protected]>

* Remove comment

Co-authored-by: Brad Jorsch <[email protected]>

* Remove inaccurate changelogs

* Make params explicitly nullable

* Oops: onlyMethods → addMethods

* Another onlyMethods → addMethods

* Last one

* Split existing and new methods to mock

* Prevent error when not adding new methods

* Update Phan baselines

* Use a more recent theme

* Remove unneeded @requires

* Update composer.lock

* Debug

* More debug

* Remove debug

* Remove more debug

* Oops, missed one

* Add another changelog

---------

Co-authored-by: Rafael Agostini <[email protected]>
Co-authored-by: Brad Jorsch <[email protected]>
…40110)

* Repo Gardening: update Type column in project board based off label

If we can extract the type of the issue from the labels, we will update our project board's "Type" column accordingly.

* Get rid of extra label check when an issue is being labeled

The added label is already returned by getLabels.

* Simplify issue type management

I made some changes to the One Board settings to make things simpler.

* Fix project type extraction

* Fix string check
* Add threat count to scan tab

* changelog
* Fix backup pricing card loading placeholder

* Changelog
heavyweight and others added 27 commits November 14, 2024 12:43
* Sync new option

* changelog
* Jetpack AI: Make sure we validate that the new option exists

* changelog
* Add growth plans to features in wpcomsh to sync with wpcom

* changelog
* Add Jetpack Growth to constants

* changelog

* Update projects/plugins/jetpack/_inc/client/lib/plans/constants.js

Co-authored-by: Bryan Elliott <[email protected]>

* Explicitly set the growth icon to the generic Jetpack icon like the other bundles

* Add growth to get monthly product by yearly function

---------

Co-authored-by: Bryan Elliott <[email protected]>
First, for projects that have both JS and PHP tests or multiple suites
of tests, run all the tests for coverage even if one fails. Mostly this
means using the `concurrently` package, since that's a very easy way to
run both and collect the exit statuses.

Then, in the workflow itself, add `always()` to the `if` on the step for
processing coverage reports so it runs even if the tests failed to
process whatever data is available.
Mark Jetpack Dashboard connection cards as "not promotional" to make them always show up properly.
* Migrate to WordPress.com: remove the plugin

The plugin is now developed by a partner, and no longer by a12s. The version currently available in the Jetpack monorepo no longer matches the version available in the WordPress.org plugin directory.

This commit removes all contents of the plugin in the monorepo, and only leaves indicators that this specific version (and its mirror repo and Packagist package) are no longer maintained, and archived.

* Add some basic files back

* Add lock file back

* Add gitattributes back

* Add more files back

* Add changelog back

* Update lock file

* Remove note from changelog file

I believe it's tripping our changelog validity check

* Remove the plugin entirely

* Remove changelog entry
* Update supported versions

* Get script artifacts

* Update docs

* Remove rule redundant to PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated

* Update tests

* Add changelog

* Add LC_ALL

* Adjust shebang
If this hasn't been done in a while, various later steps may fail due to
things like phpcs being out of date or parallel-lint being missing. It's
straightforward enough to have the script do it and avoid these problems.
Bring in a few new features:

* Ability to specify multiple projects to test, which will be run in
  parallel if `--verbose` is not used.
* Correct handling of tests that use `ARTIFACTS_DIR`.
* Correct handling of coverage tests, without having to manually set
  `COVERAGE_DIR`.
* Coverage tests now generate an HTML report by default.

Unfortunately, there are some breaking changes here:

* The order of the "test" and "project" arguments has changed.
* By default the output from PHPUnit or jest will no longer be shown.
  Run with `--verbose` if you want to see it.
Too many different projects with too many threads makes a test time out.
* allow for null or boolean values on postContent

* pass postContent as true on general image as we don't want empty posts to disable the input

* add changelog
…ic/jetpack into add/new-external-media-endpoint
@zaerl
Copy link
Contributor Author

zaerl commented Nov 15, 2024

Closed for problems that occurred during the rebase. See #40207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

External Media: Adapt image selection