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 authored Jul 19, 2024
2 parents fc44d39 + 61331d1 commit c00ff3a
Show file tree
Hide file tree
Showing 13 changed files with 156 additions and 118 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
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
name: No Response
name: 'Close stale issues'

# **What it does**: Closes issues where the original author doesn't respond to a request for information.
# **Why we have it**: To remove the need for maintainers to remember to check back on issues periodically to see if contributors have responded.
# **Who does it impact**: Everyone that works on docs or docs-internal.

on:
issue_comment:
types: [created]
schedule:
# Schedule for five minutes after the hour, every hour
- cron: '5 * * * *'
# Schedule for every day at 1:30am UTC
- cron: '30 1 * * *'

permissions:
issues: write

jobs:
noResponse:
stale:
runs-on: ubuntu-latest
steps:
- uses: lee-dohm/[email protected]
- uses: actions/stale@v9
with:
token: ${{ github.token }}
daysUntilClose: 14 # Number of days of inactivity before an Issue is closed for lack of response
responseRequiredLabel: "Reporter Feedback" # Label indicating that a response from the original author is required
closeComment: >
days-before-stale: 7
days-before-close: 7
stale-issue-message: >
It has been 7 days since more information was requested from you in this issue and we have not heard back. This issue is now marked as stale and will be closed in 7 days, but if you have more information to add then please comment and the issue will stay open.
close-issue-message: >
This issue has been automatically closed because there has been no response
to our request for more information. With only the
information that is currently in the issue, we don't have enough information
to take action. Please reach out if you have or find the answers we need so
that we can investigate further. See [this blog post on bug reports and the
importance of repro steps](https://www.lee-dohm.com/2015/01/04/writing-good-bug-reports/)
for more information about the kind of information that may be helpful.
stale-issue-label: 'stale'
close-issue-reason: 'not_planned'
any-of-labels: 'Reporter Feedback'
remove-stale-when-updated: true
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
Loading

0 comments on commit c00ff3a

Please sign in to comment.