Skip to content

Commit

Permalink
Merge branch 'develop' into upkeep/1250
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 committed Jul 19, 2024
2 parents ca04b5b + 61331d1 commit c66b789
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/release-pull-request-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]: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.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).*

Expand Down
42 changes: 22 additions & 20 deletions assets/js/gutenberg-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion distributor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion includes/pull-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
9 changes: 6 additions & 3 deletions includes/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) {
?>
<div class="notice notice-warning">
Expand Down Expand Up @@ -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'] );
}
}

Expand Down
4 changes: 1 addition & 3 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit c66b789

Please sign in to comment.