diff --git a/.github/release-pull-request-template.md b/.github/release-pull-request-template.md index f806222f5..4b1cd9fb7 100644 --- a/.github/release-pull-request-template.md +++ b/.github/release-pull-request-template.md @@ -10,6 +10,7 @@ - [ ] Update this pull request's status from `draft` to `ready to merge`. - [ ] Review: Do a review of the commit to the `stable` branch to ensure the contents of the diffs are as expected. - [ ] Test: Check out the `stable` branch and test it locally to ensure everything works as expected. It is recommended that you rename the existing `distributor` directory and check out `stable` fresh because switching branches does not delete files. This can be done with `git clone --single-branch --branch stable git@github.com:10up/distributor.git` +- [ ] Either perform a regression testing utilizing the available [Critical Flows](https://10up.github.io/Open-Source-Best-Practices/testing/#critical-flows) and Test Cases or if [end-to-end tests](https://10up.github.io/Open-Source-Best-Practices/testing/#e2e-testing) cover a significant portion of those Critical Flows then run e2e tests. Only proceed if everything tests successfully. - [ ] Release: Create a [new release](https://github.com/10up/distributor/releases/new), naming the tag and the release with the new version number, and **targeting the `stable` branch**. Paste the changelog from `CHANGELOG.md` into the body of the release and include a link to the [closed issues on the milestone](https://github.com/10up/distributor/milestone/#?closed=1). The release should now appear under [releases](https://github.com/10up/distributor/releases). - [ ] Check release: Wait for the [Publish Release Action](https://github.com/10up/distributor/actions?query=workflow%3A%22Publish+Release%22) to complete, and then check the latest release to ensure that the ZIP has been attached as an asset. Download the ZIP and inspect the contents to be sure they match the contents of the `stable` branch. - [ ] Close milestone: Edit the [milestone](https://github.com/10up/distributor/milestone/#) with release date (in the `Due date (optional)` field) and link to GitHub release (in the `Description` field), then close the milestone. diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 5dfe53762..65ef3ed29 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -47,11 +47,11 @@ jobs: - {name: 'PHP Default', version: null} core: - {name: 'WP stable', version: 'latest'} - - {name: 'WP 5.7', version: 'WordPress/WordPress#5.7'} + - {name: 'WP 6.3', version: 'WordPress/WordPress#6.3'} - {name: 'WP trunk', version: 'WordPress/WordPress#master'} include: - php: {name: 'PHP 7.4', version: '7.4'} - core: {name: 'WP 5.7', version: 'WordPress/WordPress#5.7'} + core: {name: 'WP 6.3', version: 'WordPress/WordPress#6.3'} - php: {name: 'PHP 8.1', version: '8.1'} core: {name: 'WP stable', version: 'latest'} steps: diff --git a/.github/workflows/release-pull-request.yml b/.github/workflows/release-pull-request.yml index 88826afdc..a6e623d53 100644 --- a/.github/workflows/release-pull-request.yml +++ b/.github/workflows/release-pull-request.yml @@ -14,7 +14,7 @@ jobs: BRANCH=${GITHUB_REF##*/} echo $BRANCH VERSION=${BRANCH#'release/'} - echo ::set-output name=result::"Release: ${VERSION}" + echo "result="Release: ${VERSION}"" >> $GITHUB_OUTPUT id: title - name: Create Pull Request run: gh pr create --draft --title "${{ steps.title.outputs.result }}" --body-file ./.github/release-pull-request-template.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d0e76b3f0..406384c47 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,6 +22,10 @@ Pull requests represent a proposed solution to a specified problem. They should For more on how 10up writes and manages code, check out our [10up Engineering Best Practices](https://10up.github.io/Engineering-Best-Practices/). +### Testing + +Helping to test an open source project and provide feedback on success or failure of those tests is also a helpful contribution. You can find details on the Critical Flows and Test Cases in [this project's GitHub Wiki](https://github.com/10up/distributor/wiki/Critical-Flows) as well as details on our overall approach to [Critical Flows and Test Cases in our Open Source Best Practices](https://10up.github.io/Open-Source-Best-Practices/testing/#critial-flows). Submitting the results of testing via our Critical Flows as a comment on a Pull Request of a specific feature or as an Issue when testing the entire project is the best approach for providing testing results. + ## Workflow The `develop` branch is the development branch which means it contains the next version to be released. `stable` contains the current latest release and `trunk` contains the corresponding stable development version. Always work on the `develop` branch and open up PRs against `develop`. diff --git a/README.md b/README.md index 484e183df..a17e3cfbe 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ > Distributor is a WordPress plugin that makes it easy to distribute and reuse content across your websites — whether in a single multisite or across the web. -[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Tests](https://github.com/10up/distributor/actions/workflows/test.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/test.yml) [![Linting](https://github.com/10up/distributor/actions/workflows/lint.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/lint.yml) [![Code scanning](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml) [![Release Version](https://img.shields.io/github/release/10up/distributor.svg)](https://github.com/10up/distributor/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v6.4%20tested-success.svg) [![License](https://img.shields.io/github/license/10up/distributor.svg)](https://github.com/10up/distributor/blob/develop/LICENSE.md) +[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Tests](https://github.com/10up/distributor/actions/workflows/test.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/test.yml) [![Linting](https://github.com/10up/distributor/actions/workflows/lint.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/lint.yml) [![Code scanning](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml) [![Release Version](https://img.shields.io/github/release/10up/distributor.svg)](https://github.com/10up/distributor/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v6.5%20tested-success.svg) [![License](https://img.shields.io/github/license/10up/distributor.svg)](https://github.com/10up/distributor/blob/develop/LICENSE.md) *You can learn more about Distributor's features at [DistributorPlugin.com](https://distributorplugin.com) and documentation at the [Distributor documentation site](https://10up.github.io/distributor/).* diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 2fe6800c2..8b1448222 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -153,45 +153,47 @@ const DistributorIcon = () => ( * Add the Distributor panel to Gutenberg */ const DistributorPlugin = () => { - // Ensure the user has proper permissions - if ( - dtGutenberg.noPermissions && - 1 === parseInt( dtGutenberg.noPermissions ) - ) { - return null; - } - - // eslint-disable-next-line no-shadow, react-hooks/rules-of-hooks -- permission checks are needed. + // eslint-disable-next-line no-shadow const postType = useSelect( ( select ) => select( 'core/editor' ).getCurrentPostType() ); - // eslint-disable-next-line no-shadow, react-hooks/rules-of-hooks -- permission checks are needed. + // eslint-disable-next-line no-shadow const postStatus = useSelect( ( select ) => select( 'core/editor' ).getCurrentPostAttribute( 'status' ) ); - // Ensure we are on a supported post type - if ( - dtGutenberg.supportedPostTypes && - dtGutenberg.supportedPostTypes[ postType ] === undefined - ) { - return null; - } - + // eslint-disable-next-line @wordpress/no-unused-vars-before-return const distributorTopMenu = document.querySelector( '#wp-admin-bar-distributor' ); - // eslint-disable-next-line no-shadow, react-hooks/rules-of-hooks -- permission checks are needed. + // eslint-disable-next-line no-shadow const post = useSelect( ( select ) => select( 'core/editor' ).getCurrentPost() ); + + // Ensure the user has proper permissions. + if ( + dtGutenberg.noPermissions && + 1 === parseInt( dtGutenberg.noPermissions ) + ) { + return null; + } + + // Ensure we are on a supported post type. + if ( + dtGutenberg.supportedPostTypes && + dtGutenberg.supportedPostTypes[ postType ] === undefined + ) { + return null; + } + // Make the post title and status available to the top menu. dt.postTitle = post.title; dt.postStatus = post.status; - // If we are on a non-supported post status, change what we show + // If we are on a non-supported post status, change what we show. if ( dtGutenberg.supportedPostStati && ! dtGutenberg.supportedPostStati.includes( postStatus ) diff --git a/distributor.php b/distributor.php index 486b47c71..69626649d 100644 --- a/distributor.php +++ b/distributor.php @@ -5,7 +5,7 @@ * Update URI: https://distributorplugin.com * Description: Makes it easy to distribute and reuse content across your websites, whether inside of a multisite or across the web. * Version: 2.0.4 - * Requires at least: 5.7 + * Requires at least: 6.3 * Requires PHP: 7.4 * Author: 10up Inc. * Author URI: https://distributorplugin.com diff --git a/includes/pull-ui.php b/includes/pull-ui.php index f56c02a73..4b62b6c53 100644 --- a/includes/pull-ui.php +++ b/includes/pull-ui.php @@ -576,8 +576,10 @@ function output_pull_errors() { if ( is_a( $connection_now, '\Distributor\ExternalConnection' ) ) { $error_key = "external_{$connection_now->id}"; - } else { + } elseif ( is_a( $connection_now, '\Distributor\InternalConnections\NetworkSiteConnection' ) ) { $error_key = "internal_{$connection_now->site->blog_id}"; + } else { + return; } $pull_errors = get_transient( 'dt_connection_pull_errors_' . $error_key ); diff --git a/includes/settings.php b/includes/settings.php index afee92722..8e86456e6 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -125,7 +125,11 @@ function update_notice( $plugin_file, $plugin_data, $status ) { * @since 1.2 */ function maybe_notice() { - if ( 0 === strpos( get_current_screen()->parent_base, 'distributor' ) ) { + $parent_base = get_current_screen()->parent_base; + if ( ! $parent_base ) { + return; + } + if ( 0 === strpos( $parent_base, 'distributor' ) ) { if ( Utils\is_development_version() ) { ?>
@@ -177,8 +181,7 @@ function admin_enqueue_scripts( $hook ) { if ( file_exists( $asset_file ) ) { $asset_data = require $asset_file; } - - wp_enqueue_style( 'dt-admin-settings', plugins_url( '/dist/css/admin-settings.min.css', __DIR__ ), array(), $asset_data['version'] ); + wp_enqueue_style( 'dt-admin-settings-screen', plugins_url( '/dist/css/admin-settings.min.css', __DIR__ ), array(), $asset_data['version'] ); } } diff --git a/readme.txt b/readme.txt index e2eea5b18..f4a5fab65 100644 --- a/readme.txt +++ b/readme.txt @@ -1,9 +1,7 @@ === Distributor === Contributors: 10up Tags: content, distribution, syndication, management -Requires at least: 5.7 -Tested up to: 6.4 -Requires PHP: 7.4 +Tested up to: 6.6 Stable tag: 2.0.4 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html