From e5308b15589cab3a5fc0e0ae19a53783627f90ce Mon Sep 17 00:00:00 2001 From: Arun Date: Sat, 13 Jan 2024 12:38:14 -0800 Subject: [PATCH 01/14] ci: Use GITHUB_OUTPUT envvar instead of set-output command --- .github/workflows/release-pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From c1bb168d5915b7dd58cb6201e6408c0c330caa50 Mon Sep 17 00:00:00 2001 From: Peter Sorensen Date: Thu, 21 Mar 2024 12:21:18 -0700 Subject: [PATCH 02/14] fix missing css Updates the ID of the admin-settings.css enqueue as it was conflicting with the admin.css enqueue ID --- includes/settings.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/settings.php b/includes/settings.php index afee92722..28ad3a25f 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -177,8 +177,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'] ); } } From 428404ed6212ef530f795eaf72787df1493877a3 Mon Sep 17 00:00:00 2001 From: Jeffrey Paul Date: Wed, 10 Apr 2024 17:05:50 -0500 Subject: [PATCH 03/14] bump WordPress "tested up to" version 6.5 Co-Authored-By: Sumit Bagthariya <67687255+qasumitbagthariya@users.noreply.github.com> --- README.md | 2 +- distributor.php | 2 +- readme.txt | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a8757470b..bb251c0c8 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/distributor.php b/distributor.php index 15130d8e1..ef62a3fe8 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.1 - * 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/readme.txt b/readme.txt index fbea1baae..6e540dde0 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.5 Stable tag: 2.0.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html From 0bb6193639f488068dac2b839299fc45f36af1b7 Mon Sep 17 00:00:00 2001 From: Jeffrey Paul Date: Wed, 10 Apr 2024 17:08:10 -0500 Subject: [PATCH 04/14] Update cypress.yml --- .github/workflows/cypress.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 15f8b70a4..806f5445f 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: From 5ff2a82159a884a219e74f70a631d71ec35ae361 Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Mon, 22 Apr 2024 12:35:24 +0530 Subject: [PATCH 05/14] Bumped `actions/upload-artifact` from v3 to v4 --- .github/workflows/cypress.yml | 2 +- .github/workflows/generate-zip.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 806f5445f..65ef3ed29 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -108,7 +108,7 @@ jobs: npx mochawesome-report-generator tests/cypress/reports/mochawesome.json -o tests/cypress/reports/ cat ./tests/cypress/reports/mochawesome.md >> $GITHUB_STEP_SUMMARY - name: Make artifacts available - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: cypress-artifact diff --git a/.github/workflows/generate-zip.yml b/.github/workflows/generate-zip.yml index da116934d..eb8c6c091 100644 --- a/.github/workflows/generate-zip.yml +++ b/.github/workflows/generate-zip.yml @@ -42,7 +42,7 @@ jobs: rm -rf ./release && unzip ${{ github.event.repository.name }}.zip -d ./release - name: Upload the ZIP file as an artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ github.event.repository.name }} path: release From 657cf9cadf1879e2e45f55158cae12075ede294a Mon Sep 17 00:00:00 2001 From: Konstantinos Galanakis Date: Fri, 26 Apr 2024 10:05:48 +0300 Subject: [PATCH 06/14] Add "Testing" section to the "CONTRIBUTING.md" file --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d0e76b3f0..127c81860 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 the respective GitHub Wiki 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`. From 1da26b10fcd4d6eb854d77c15c8a9fd19d6eca52 Mon Sep 17 00:00:00 2001 From: Jeffrey Paul Date: Mon, 13 May 2024 12:43:46 -0500 Subject: [PATCH 07/14] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 127c81860..406384c47 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ For more on how 10up writes and manages code, check out our [10up Engineering Be ### 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 the respective GitHub Wiki 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. +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 From e0af360a73e8d71fd6a4e9769d666779df45a998 Mon Sep 17 00:00:00 2001 From: Jeffrey Paul Date: Tue, 14 May 2024 16:46:31 -0500 Subject: [PATCH 08/14] Update release-pull-request-template.md --- .github/release-pull-request-template.md | 1 + 1 file changed, 1 insertion(+) 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. From 115a90a02b85b0aeaab36352d0fcedf23f71a98d Mon Sep 17 00:00:00 2001 From: Kirtan Gajjar <8456197+kirtangajjar@users.noreply.github.com> Date: Sun, 9 Jun 2024 04:19:35 +0530 Subject: [PATCH 09/14] Add check for internal connection --- includes/pull-ui.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 ); From ae93de89d0732c03524813c97eaf2337020b1e3a Mon Sep 17 00:00:00 2001 From: Kirtan Gajjar <8456197+kirtangajjar@users.noreply.github.com> Date: Sat, 15 Jun 2024 14:27:14 +0530 Subject: [PATCH 10/14] Fix strpos first arg null warning in php 8.1 --- includes/settings.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/settings.php b/includes/settings.php index afee92722..31ea9826b 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -125,7 +125,8 @@ 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 ( 0 === strpos( $parent_base, 'distributor' ) ) { if ( Utils\is_development_version() ) { ?>
From d520ab43051d4de5fcc6356be53131b135dd35c4 Mon Sep 17 00:00:00 2001 From: Kirtan Gajjar <8456197+kirtangajjar@users.noreply.github.com> Date: Sat, 15 Jun 2024 21:39:07 +0530 Subject: [PATCH 11/14] Follow react rules of hooks --- assets/js/gutenberg-plugin.js | 36 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index 2fe6800c2..e8adfac90 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -153,24 +153,34 @@ 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. 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 -- permission checks are needed. const postStatus = useSelect( ( select ) => select( 'core/editor' ).getCurrentPostAttribute( 'status' ) ); + // eslint-disable-next-line @wordpress/no-unused-vars-before-return + const distributorTopMenu = document.querySelector( + '#wp-admin-bar-distributor' + ); + + // eslint-disable-next-line no-shadow -- permission checks are needed. + 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 && @@ -179,14 +189,6 @@ const DistributorPlugin = () => { return null; } - const distributorTopMenu = document.querySelector( - '#wp-admin-bar-distributor' - ); - - // eslint-disable-next-line no-shadow, react-hooks/rules-of-hooks -- permission checks are needed. - const post = useSelect( ( select ) => - select( 'core/editor' ).getCurrentPost() - ); // Make the post title and status available to the top menu. dt.postTitle = post.title; dt.postStatus = post.status; From 045da70e377ebf94e19083db0520a683de19f3b6 Mon Sep 17 00:00:00 2001 From: Faisal Alvi Date: Wed, 3 Jul 2024 17:00:33 +0530 Subject: [PATCH 12/14] Update includes/settings.php Co-authored-by: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> --- includes/settings.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/settings.php b/includes/settings.php index 31ea9826b..1acd0df39 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -125,7 +125,10 @@ function update_notice( $plugin_file, $plugin_data, $status ) { * @since 1.2 */ function maybe_notice() { - $parent_base = get_current_screen()->parent_base ?? ''; + $parent_base = get_current_screen()->parent_base; + if ( ! $parent_base ) { + return; + } if ( 0 === strpos( $parent_base, 'distributor' ) ) { if ( Utils\is_development_version() ) { ?> From 74334de19cff52b2eba722f503e3adae61991ba9 Mon Sep 17 00:00:00 2001 From: Sumit Bagthariya <67687255+qasumitbagthariya@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:07:33 +0530 Subject: [PATCH 13/14] Update readme.txt --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index c611e18c9..f4a5fab65 100644 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ === Distributor === Contributors: 10up Tags: content, distribution, syndication, management -Tested up to: 6.5 +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 From d0bf34a4bb6283cb63f2ab286a9d6c2f2ad75fdb Mon Sep 17 00:00:00 2001 From: Siddharth Thevaril Date: Sun, 14 Jul 2024 21:21:45 +0530 Subject: [PATCH 14/14] fix documentation --- assets/js/gutenberg-plugin.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/js/gutenberg-plugin.js b/assets/js/gutenberg-plugin.js index e8adfac90..8b1448222 100644 --- a/assets/js/gutenberg-plugin.js +++ b/assets/js/gutenberg-plugin.js @@ -153,12 +153,12 @@ const DistributorIcon = () => ( * Add the Distributor panel to Gutenberg */ const DistributorPlugin = () => { - // 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 -- permission checks are needed. + // eslint-disable-next-line no-shadow const postStatus = useSelect( ( select ) => select( 'core/editor' ).getCurrentPostAttribute( 'status' ) ); @@ -168,12 +168,12 @@ const DistributorPlugin = () => { '#wp-admin-bar-distributor' ); - // eslint-disable-next-line no-shadow -- permission checks are needed. + // eslint-disable-next-line no-shadow const post = useSelect( ( select ) => select( 'core/editor' ).getCurrentPost() ); - // Ensure the user has proper permissions + // Ensure the user has proper permissions. if ( dtGutenberg.noPermissions && 1 === parseInt( dtGutenberg.noPermissions ) @@ -181,7 +181,7 @@ const DistributorPlugin = () => { return null; } - // Ensure we are on a supported post type + // Ensure we are on a supported post type. if ( dtGutenberg.supportedPostTypes && dtGutenberg.supportedPostTypes[ postType ] === undefined @@ -193,7 +193,7 @@ const DistributorPlugin = () => { 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 )