From 5724b92e89afaa32dcc3dcd7d85cb4e5b9665238 Mon Sep 17 00:00:00 2001
From: Jeffrey Paul
Date: Tue, 19 Apr 2022 22:06:53 -0500
Subject: [PATCH 01/26] Create dependency-review.yml
---
.github/workflows/dependency-review.yml | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 .github/workflows/dependency-review.yml
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
new file mode 100644
index 00000000..0e72a00e
--- /dev/null
+++ b/.github/workflows/dependency-review.yml
@@ -0,0 +1,20 @@
+# Dependency Review Action
+#
+# This Action will scan dependency manifest files that change as part of a Pull Reqest, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
+#
+# Source repository: https://github.com/actions/dependency-review-action
+# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
+name: 'Dependency Review'
+on: [pull_request]
+
+permissions:
+ contents: read
+
+jobs:
+ dependency-review:
+ runs-on: ubuntu-latest
+ steps:
+ - name: 'Checkout Repository'
+ uses: actions/checkout@v3
+ - name: 'Dependency Review'
+ uses: actions/dependency-review-action@v1
From 0de125917cd86469d34888cb2812ab0d28c07fb5 Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Fri, 13 May 2022 16:39:12 +0530
Subject: [PATCH 02/26] Handle publish tweet from staging/testing site.
---
includes/admin/post-transition.php | 15 ++
includes/class-ast-staging.php | 215 +++++++++++++++++++++++++++++
includes/core.php | 5 +
3 files changed, 235 insertions(+)
create mode 100644 includes/class-ast-staging.php
diff --git a/includes/admin/post-transition.php b/includes/admin/post-transition.php
index 636e5337..7504526b 100644
--- a/includes/admin/post-transition.php
+++ b/includes/admin/post-transition.php
@@ -8,6 +8,7 @@
namespace TenUp\AutoshareForTwitter\Core\Post_Transition;
use TenUp\AutoshareForTwitter\Core\Publish_Tweet\Publish_Tweet;
+use TenUp\AutoshareForTwitter\Core\AST_Staging\AST_Staging;
use TenUp\AutoshareForTwitter\Core\Post_Meta as Meta;
use TenUp\AutoshareForTwitter\Utils as Utils;
use function TenUp\AutoshareForTwitter\Utils\delete_autoshare_for_twitter_meta;
@@ -61,6 +62,13 @@ function maybe_publish_tweet( $new_status, $old_status, $post ) {
return;
}
+ /**
+ * Don't publish tweets from staging/testing sites.
+ */
+ if ( AST_Staging::is_duplicate_site() ) {
+ return;
+ }
+
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
add_action(
sprintf( 'rest_after_insert_%s', $post->post_type ),
@@ -93,6 +101,13 @@ function publish_tweet( $post_id ) {
return;
}
+ /**
+ * Don't publish tweets from staging/testing sites.
+ */
+ if ( AST_Staging::is_duplicate_site() ) {
+ return;
+ }
+
// Ensure we have a $post object.
if ( ! $post ) {
return;
diff --git a/includes/class-ast-staging.php b/includes/class-ast-staging.php
new file mode 100644
index 00000000..f733ebfc
--- /dev/null
+++ b/includes/class-ast-staging.php
@@ -0,0 +1,215 @@
+
+
+
+ tags. 3$-4$: Opening and closing link to production URL. 5$: Production URL.
+ esc_html__( 'It looks like this site has moved or is a duplicate site. %1$sAutoshare for Twitter%2$s has disabled publish tweets on this site to prevent tweets from a staging or test environment. %1$sAutoshare for Twitter%2$s considers %3$s%5$s%4$s to be the site\'s URL. ', 'autoshare-for-twitter' ),
+ '',
+ '',
+ '',
+ '',
+ esc_url( self::get_site_url_from_source( 'autoshare' ) ),
+ )
+ ?>
+
+
+
+
+
+
+
+
+
+
+
Date: Fri, 13 May 2022 17:11:40 +0530
Subject: [PATCH 03/26] phpcs fixes.
---
includes/class-ast-staging.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/includes/class-ast-staging.php b/includes/class-ast-staging.php
index f733ebfc..57437d00 100644
--- a/includes/class-ast-staging.php
+++ b/includes/class-ast-staging.php
@@ -72,7 +72,7 @@ public static function handle_site_change_notice() {
'',
'',
'',
- esc_url( self::get_site_url_from_source( 'autoshare' ) ),
+ esc_url( self::get_site_url_from_source( 'autoshare' ) )
)
?>
@@ -168,7 +168,7 @@ public static function set_autoshare_site_url_lock() {
*/
public static function get_autoshare_site_url_lock_key() {
$site_url = self::get_site_url_from_source( 'current_wp_site' );
- $scheme = parse_url( $site_url, PHP_URL_SCHEME ) . '://';
+ $scheme = wp_parse_url( $site_url, PHP_URL_SCHEME ) . '://';
$site_url = str_replace( $scheme, '', $site_url );
return $scheme . substr_replace( $site_url, '_[autoshare_siteurl]_', strlen( $site_url ) / 2, 0 );
From e46ade186de00cd74a47d56dae76a52d2f17621a Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Mon, 16 May 2022 17:56:51 +0530
Subject: [PATCH 04/26] Removed unwanted code as suggested in PR feedback.
---
includes/class-ast-staging.php | 2 --
1 file changed, 2 deletions(-)
diff --git a/includes/class-ast-staging.php b/includes/class-ast-staging.php
index 57437d00..ba0d8ba2 100644
--- a/includes/class-ast-staging.php
+++ b/includes/class-ast-staging.php
@@ -204,8 +204,6 @@ public static function get_authoshare_live_site_url() {
public static function get_site_url_from_source( $source = 'current_wp_site' ) {
if ( 'autoshare' === $source ) {
$site_url = self::get_authoshare_live_site_url();
- } elseif ( ! is_multisite() && defined( 'WP_SITEURL' ) ) {
- $site_url = WP_SITEURL;
} else {
$site_url = get_site_url();
}
From 9544c269909a211022a6063b3e5858ef272de5d5 Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Tue, 17 May 2022 20:28:59 +0530
Subject: [PATCH 05/26] Updated `is_duplicate` to `is_production` and updated
`site_url` with `home_url`.
---
includes/admin/post-transition.php | 4 +-
includes/class-ast-staging.php | 84 +++++++++++++++---------------
2 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/includes/admin/post-transition.php b/includes/admin/post-transition.php
index 7504526b..e1337aeb 100644
--- a/includes/admin/post-transition.php
+++ b/includes/admin/post-transition.php
@@ -65,7 +65,7 @@ function maybe_publish_tweet( $new_status, $old_status, $post ) {
/**
* Don't publish tweets from staging/testing sites.
*/
- if ( AST_Staging::is_duplicate_site() ) {
+ if ( ! AST_Staging::is_production_site() ) {
return;
}
@@ -104,7 +104,7 @@ function publish_tweet( $post_id ) {
/**
* Don't publish tweets from staging/testing sites.
*/
- if ( AST_Staging::is_duplicate_site() ) {
+ if ( ! AST_Staging::is_production_site() ) {
return;
}
diff --git a/includes/class-ast-staging.php b/includes/class-ast-staging.php
index ba0d8ba2..7c193fb2 100644
--- a/includes/class-ast-staging.php
+++ b/includes/class-ast-staging.php
@@ -19,7 +19,7 @@ class AST_Staging {
* Add actions
*/
public static function init() {
- add_action( 'init', array( __CLASS__, 'maybe_add_autoshare_site_url' ) );
+ add_action( 'init', array( __CLASS__, 'maybe_add_autoshare_live_url' ) );
add_action( 'admin_init', array( __CLASS__, 'handle_site_change_notice_actions' ) );
add_action( 'admin_notices', array( __CLASS__, 'handle_site_change_notice' ) );
}
@@ -30,7 +30,7 @@ public static function init() {
* @since 1.2.0
*/
public static function handle_site_change_notice_actions() {
- if ( self::is_duplicate_site() && current_user_can( 'manage_options' ) ) {
+ if ( ! self::is_production_site() && current_user_can( 'manage_options' ) ) {
if (
! empty( $_GET['_astnonce'] ) &&
@@ -39,9 +39,9 @@ public static function handle_site_change_notice_actions() {
) {
$duplicate_site = sanitize_text_field( wp_unslash( $_GET['autoshare_duplicate_site'] ) );
if ( 'update' === $duplicate_site ) {
- self::set_autoshare_site_url_lock();
+ self::set_autoshare_live_url_lock();
} elseif ( 'ignore' === $duplicate_site ) {
- update_option( 'autoshare_ignore_duplicate_siteurl_notice', self::get_autoshare_site_url_lock_key() );
+ update_option( 'autoshare_ignore_duplicate_site_notice', self::get_autoshare_live_url_lock_key() );
}
wp_safe_redirect( remove_query_arg( array( 'autoshare_duplicate_site', '_astnonce' ) ) );
}
@@ -55,9 +55,9 @@ public static function handle_site_change_notice_actions() {
*/
public static function handle_site_change_notice() {
if (
- self::is_duplicate_site() &&
+ ! self::is_production_site() &&
current_user_can( 'manage_options' ) &&
- self::get_autoshare_site_url_lock_key() !== get_option( 'autoshare_ignore_duplicate_siteurl_notice' )
+ self::get_autoshare_live_url_lock_key() !== get_option( 'autoshare_ignore_duplicate_site_notice' )
) {
$ignore_url = wp_nonce_url( add_query_arg( 'autoshare_duplicate_site', 'ignore' ), 'ast_duplicate_site', '_astnonce' );
$update_url = wp_nonce_url( add_query_arg( 'autoshare_duplicate_site', 'update' ), 'ast_duplicate_site', '_astnonce' );
@@ -70,9 +70,9 @@ public static function handle_site_change_notice() {
esc_html__( 'It looks like this site has moved or is a duplicate site. %1$sAutoshare for Twitter%2$s has disabled publish tweets on this site to prevent tweets from a staging or test environment. %1$sAutoshare for Twitter%2$s considers %3$s%5$s%4$s to be the site\'s URL. ', 'autoshare-for-twitter' ),
'',
'',
- '',
+ '',
'',
- esc_url( self::get_site_url_from_source( 'autoshare' ) )
+ esc_url( self::get_url_from_source( 'autoshare' ) )
)
?>
@@ -90,26 +90,26 @@ public static function handle_site_change_notice() {
}
/**
- * Determines if this is a testing/staging site.
+ * Determines if this is a production site.
*
* Checks if the WordPress site URL is the same as the URL Autoshare considers the live URL.
*
* @since 1.2.0
- * @return bool Whether the site is a staging URL or not.
+ * @return bool Whether the site is a production URL or not.
*/
- public static function is_duplicate_site() {
- $wp_site_url_parts = wp_parse_url( self::get_site_url_from_source( 'current_wp_site' ) );
- $ast_site_url_parts = wp_parse_url( self::get_site_url_from_source( 'autoshare' ) );
+ public static function is_production_site() {
+ $wp_url_parts = wp_parse_url( self::get_url_from_source( 'current_wp_site' ) );
+ $ast_url_parts = wp_parse_url( self::get_url_from_source( 'autoshare' ) );
- if ( ! isset( $wp_site_url_parts['path'] ) && ! isset( $ast_site_url_parts['path'] ) ) {
+ if ( ! isset( $wp_url_parts['path'] ) && ! isset( $ast_url_parts['path'] ) ) {
$paths_match = true;
- } elseif ( isset( $wp_site_url_parts['path'] ) && isset( $ast_site_url_parts['path'] ) && $wp_site_url_parts['path'] === $ast_site_url_parts['path'] ) {
+ } elseif ( isset( $wp_url_parts['path'] ) && isset( $ast_url_parts['path'] ) && $wp_url_parts['path'] === $ast_url_parts['path'] ) {
$paths_match = true;
} else {
$paths_match = false;
}
- if ( isset( $wp_site_url_parts['host'] ) && isset( $ast_site_url_parts['host'] ) && $wp_site_url_parts['host'] === $ast_site_url_parts['host'] ) {
+ if ( isset( $wp_url_parts['host'] ) && isset( $ast_url_parts['host'] ) && $wp_url_parts['host'] === $ast_url_parts['host'] ) {
$hosts_match = true;
} else {
$hosts_match = false;
@@ -117,18 +117,18 @@ public static function is_duplicate_site() {
// Check the host and path, do not check the protocol/scheme to avoid issues.
if ( $paths_match && $hosts_match ) {
- $is_duplicate = false;
+ $is_production = true;
} else {
- $is_duplicate = true;
+ $is_production = false;
}
/**
- * Filters value of "Is staging site?".
+ * Filters value of "Is production site?".
*
* @since 1.2.0
- * @param boolean $is_duplicate Is staging site?.
+ * @param boolean $is_production Whether the site is a production URL or not.
*/
- return apply_filters( 'autoshare_for_twitter_is_duplicate_site', $is_duplicate );
+ return apply_filters( 'autoshare_for_twitter_is_production_site', $is_production );
}
/**
@@ -136,12 +136,12 @@ public static function is_duplicate_site() {
*
* @since 1.2.0
*/
- public static function maybe_add_autoshare_site_url() {
- $autoshare_site_url = get_option( 'autoshare_siteurl', false );
+ public static function maybe_add_autoshare_live_url() {
+ $autoshare_liveurl = get_option( 'autoshare_liveurl', false );
- // Check if autoshare site url is stored in options, save option if not stored.
- if ( false === $autoshare_site_url ) {
- self::set_autoshare_site_url_lock();
+ // Check if autoshare live url is stored in options, save option if not stored.
+ if ( false === $autoshare_liveurl ) {
+ self::set_autoshare_live_url_lock();
}
}
/**
@@ -151,8 +151,8 @@ public static function maybe_add_autoshare_site_url() {
*
* @since 1.2.0
*/
- public static function set_autoshare_site_url_lock() {
- update_option( 'autoshare_siteurl', self::get_autoshare_site_url_lock_key() );
+ public static function set_autoshare_live_url_lock() {
+ update_option( 'autoshare_liveurl', self::get_autoshare_live_url_lock_key() );
}
@@ -161,31 +161,31 @@ public static function set_autoshare_site_url_lock() {
*
* The key can not simply be the site URL, e.g. http://example.com, because some hosts replaces all
* instances of the site URL in the database when creating a staging site. As a result, we obfuscate
- * the URL by inserting '_[autoshare_siteurl]_' into the middle of it.
+ * the URL by inserting '_[autoshare_liveurl]_' into the middle of it.
*
* @since 1.2.0
* @return string The autoshare site URL lock key.
*/
- public static function get_autoshare_site_url_lock_key() {
- $site_url = self::get_site_url_from_source( 'current_wp_site' );
- $scheme = wp_parse_url( $site_url, PHP_URL_SCHEME ) . '://';
- $site_url = str_replace( $scheme, '', $site_url );
+ public static function get_autoshare_live_url_lock_key() {
+ $url = self::get_url_from_source( 'current_wp_site' );
+ $scheme = wp_parse_url( $url, PHP_URL_SCHEME ) . '://';
+ $url = str_replace( $scheme, '', $url );
- return $scheme . substr_replace( $site_url, '_[autoshare_siteurl]_', strlen( $site_url ) / 2, 0 );
+ return $scheme . substr_replace( $url, '_[autoshare_liveurl]_', strlen( $url ) / 2, 0 );
}
/**
* Gets the URL Autoshare considers as the live site URL.
*
- * This URL is set by `self::set_autoshare_site_url_lock()`. This function removes the obfuscation to get a raw URL.
+ * This URL is set by `self::set_autoshare_live_url_lock()`. This function removes the obfuscation to get a raw URL.
*
* @since 1.2.0
*/
- public static function get_authoshare_live_site_url() {
- $url = get_option( 'autoshare_siteurl', '' );
+ public static function get_authoshare_live_url() {
+ $url = get_option( 'autoshare_liveurl', '' );
// Remove the prefix used to prevent the site URL being updated by search & replace.
- $url = str_replace( '_[autoshare_siteurl]_', '', $url );
+ $url = str_replace( '_[autoshare_liveurl]_', '', $url );
return $url;
}
@@ -201,13 +201,13 @@ public static function get_authoshare_live_site_url() {
* @param string $source The URL source to get. Optional. Takes values 'current_wp_site' or 'autoshare'. Default is 'current_wp_site'.
* @return string The URL.
*/
- public static function get_site_url_from_source( $source = 'current_wp_site' ) {
+ public static function get_url_from_source( $source = 'current_wp_site' ) {
if ( 'autoshare' === $source ) {
- $site_url = self::get_authoshare_live_site_url();
+ $url = self::get_authoshare_live_url();
} else {
- $site_url = get_site_url();
+ $url = get_home_url();
}
- return $site_url;
+ return $url;
}
}
From 33e44f8bcbb2ee23716f94f3d8fd568cc577a7bd Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Tue, 17 May 2022 20:32:51 +0530
Subject: [PATCH 06/26] remove some more site words
---
includes/class-ast-staging.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/includes/class-ast-staging.php b/includes/class-ast-staging.php
index 7c193fb2..d65fa5fd 100644
--- a/includes/class-ast-staging.php
+++ b/includes/class-ast-staging.php
@@ -92,7 +92,7 @@ public static function handle_site_change_notice() {
/**
* Determines if this is a production site.
*
- * Checks if the WordPress site URL is the same as the URL Autoshare considers the live URL.
+ * Checks if the current WordPress URL is the same as the URL Autoshare considers the live URL.
*
* @since 1.2.0
* @return bool Whether the site is a production URL or not.
@@ -164,7 +164,7 @@ public static function set_autoshare_live_url_lock() {
* the URL by inserting '_[autoshare_liveurl]_' into the middle of it.
*
* @since 1.2.0
- * @return string The autoshare site URL lock key.
+ * @return string The autoshare live URL lock key.
*/
public static function get_autoshare_live_url_lock_key() {
$url = self::get_url_from_source( 'current_wp_site' );
@@ -175,7 +175,7 @@ public static function get_autoshare_live_url_lock_key() {
}
/**
- * Gets the URL Autoshare considers as the live site URL.
+ * Gets the URL Autoshare considers as the live URL.
*
* This URL is set by `self::set_autoshare_live_url_lock()`. This function removes the obfuscation to get a raw URL.
*
From 5102957da3b097b228c8ccdd21dd41d68f2c862b Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Wed, 18 May 2022 19:19:09 +0530
Subject: [PATCH 07/26] Formating fixes in comment and doc blocks
---
includes/admin/post-transition.php | 18 +++++++-----------
includes/class-ast-staging.php | 6 +++++-
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/includes/admin/post-transition.php b/includes/admin/post-transition.php
index e1337aeb..b842636a 100644
--- a/includes/admin/post-transition.php
+++ b/includes/admin/post-transition.php
@@ -41,30 +41,28 @@ function setup() {
* @return object
*/
function maybe_publish_tweet( $new_status, $old_status, $post ) {
- /**
+ /*
* Add filter to return early based on post or status
*/
if ( apply_filters( 'autoshare_for_twitter_disable_on_transition_post_status', false, $post, $old_status, $new_status ) ) {
return;
}
- /**
+ /*
* We're only interested in posts that are transitioning into publish.
*/
if ( 'publish' !== $new_status || 'publish' === $old_status ) {
return;
}
- /**
+ /*
* Don't bother enqueuing assets if the post type hasn't opted into autosharing
*/
if ( ! Utils\opted_into_autoshare_for_twitter( $post->ID ) ) {
return;
}
- /**
- * Don't publish tweets from staging/testing sites.
- */
+ // Don't publish tweets from staging/testing sites.
if ( ! AST_Staging::is_production_site() ) {
return;
}
@@ -94,16 +92,14 @@ function( $post ) {
function publish_tweet( $post_id ) {
$post = get_post( $post_id );
- /**
+ /*
* Don't bother enqueuing assets if the post type hasn't opted into autosharing
*/
if ( ! Utils\opted_into_autoshare_for_twitter( $post->ID ) ) {
return;
}
- /**
- * Don't publish tweets from staging/testing sites.
- */
+ // Don't publish tweets from staging/testing sites.
if ( ! AST_Staging::is_production_site() ) {
return;
}
@@ -113,7 +109,7 @@ function publish_tweet( $post_id ) {
return;
}
- /**
+ /*
* One final check: was the "auto tweet" checkbox selected?
*/
if ( Utils\autoshare_enabled( $post->ID ) ) {
diff --git a/includes/class-ast-staging.php b/includes/class-ast-staging.php
index d65fa5fd..3a5c794a 100644
--- a/includes/class-ast-staging.php
+++ b/includes/class-ast-staging.php
@@ -11,6 +11,7 @@
* Autoshare For Twitter staging mode handler.
*
* @package TenUp\AutoshareForTwitter\Core
+ *
* @since 1.2.0
*/
class AST_Staging {
@@ -95,6 +96,7 @@ public static function handle_site_change_notice() {
* Checks if the current WordPress URL is the same as the URL Autoshare considers the live URL.
*
* @since 1.2.0
+ *
* @return bool Whether the site is a production URL or not.
*/
public static function is_production_site() {
@@ -126,6 +128,7 @@ public static function is_production_site() {
* Filters value of "Is production site?".
*
* @since 1.2.0
+ *
* @param boolean $is_production Whether the site is a production URL or not.
*/
return apply_filters( 'autoshare_for_twitter_is_production_site', $is_production );
@@ -144,6 +147,7 @@ public static function maybe_add_autoshare_live_url() {
self::set_autoshare_live_url_lock();
}
}
+
/**
* Sets the autoshare site lock key to record the site's "live" url.
*
@@ -155,7 +159,6 @@ public static function set_autoshare_live_url_lock() {
update_option( 'autoshare_liveurl', self::get_autoshare_live_url_lock_key() );
}
-
/**
* Generates a unique key based on the sites URL used to determine duplicate/staging sites.
*
@@ -164,6 +167,7 @@ public static function set_autoshare_live_url_lock() {
* the URL by inserting '_[autoshare_liveurl]_' into the middle of it.
*
* @since 1.2.0
+ *
* @return string The autoshare live URL lock key.
*/
public static function get_autoshare_live_url_lock_key() {
From 67b14ea717ed47d906cff9b2c6611306320a755b Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Fri, 20 May 2022 18:25:53 +0530
Subject: [PATCH 08/26] Bump tested up to WordPress 6.0
---
readme.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/readme.txt b/readme.txt
index 273403fb..ec8806ae 100644
--- a/readme.txt
+++ b/readme.txt
@@ -2,7 +2,7 @@
Contributors: 10up, johnwatkins0, adamsilverstein, scottlee, dinhtungdu
Tags: twitter, tweet, autoshare, auto-share, auto share, share, social media
Requires at least: 4.9
-Tested up to: 5.9
+Tested up to: 6.0
Requires PHP: 7.2
Stable tag: 1.1.1
License: GPL-2.0-or-later
From 6ab89175e5064d5b0db556766c51dc2a121613fc Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Fri, 27 May 2022 15:03:22 +0530
Subject: [PATCH 09/26] Added `autoloader-suffix` in composer config.
---
composer.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/composer.json b/composer.json
index b27de5ae..d8170d1a 100644
--- a/composer.json
+++ b/composer.json
@@ -29,6 +29,7 @@
},
"minimum-stability": "dev",
"config": {
+ "autoloader-suffix": "10upAutoshareForTwitterV111",
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
From aeeb3eb8b821ffbae52dbb1225c8f09c518d166e Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Mon, 30 May 2022 10:38:06 +0530
Subject: [PATCH 10/26] Added `autoloader-suffix` version bump in release
instructions
---
CONTRIBUTING.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ed0ee1e6..4c2e6e71 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -29,7 +29,7 @@ The `develop` branch is the development branch which means it contains the next
## Release instructions
1. Branch: Starting from `develop`, cut a release branch named `release/X.Y.Z` for your changes.
-1. Version bump: Bump the version number in `autoshare-for-twitter.php`, `readme.txt`, `package-lock.json`, and `package.json` if it does not already reflect the version being released.
+1. Version bump: Bump the version number in `autoshare-for-twitter.php`, `readme.txt`, `package-lock.json`, `package.json`, and `composer.json`(`autoloader-suffix` config option) if it does not already reflect the version being released.
1. Changelog: Add/update the changelog in `CHANGELOG.md` and `readme.txt`.
1. Props: update `CREDITS.md` with any new contributors, confirm maintainers are accurate.
1. New files: Check to be sure any new files/paths that are unnecessary in the production version are included in `.distignore`.
From 228c7597a08b42d9b47c6279c96b70b2a74e977b Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Wed, 1 Jun 2022 12:52:46 +0530
Subject: [PATCH 11/26] Run tests with `Enable by default` checked and
unchecked both.
---
.../cypress/integration/block-editor.test.js | 212 +++++++++---------
.../integration/classic-editor.test.js | 139 +++++++-----
2 files changed, 186 insertions(+), 165 deletions(-)
diff --git a/tests/cypress/integration/block-editor.test.js b/tests/cypress/integration/block-editor.test.js
index 912f169e..dc3f6626 100644
--- a/tests/cypress/integration/block-editor.test.js
+++ b/tests/cypress/integration/block-editor.test.js
@@ -16,110 +16,116 @@ describe('Test Autoshare for Twitter with Block Editor.', () => {
cy.get('#submit').click();
});
-
- it('Can disable default Autoshare', () => {
- cy.visit('/wp-admin/options-general.php?page=autoshare-for-twitter');
- cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').should('exist');
- cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').uncheck();
- cy.get('#submit').click();
- });
-
-
- it('Tests that new post is not tweeted when box is unchecked', () => {
- // Start create new post by enter post title
- cy.startCreatePost();
-
- cy.get('.editor-post-publish-panel__toggle').should('be.visible');
- cy.get('.editor-post-publish-panel__toggle').click();
-
- // Publish
- cy.get('.editor-post-publish-button').should('be.visible');
- cy.get('.editor-post-publish-button').click();
-
- // Post-publish.
- cy.get('.autoshare-for-twitter-post-status').should('be.visible');
- cy.get('.autoshare-for-twitter-post-status').contains('This post was not tweeted.');
- });
-
-
- it('Tests that new post is tweeted when box is checked', () => {
- // Start create new post by enter post title
- cy.startCreatePost();
-
- // Open pre-publish Panel.
- cy.get('.editor-post-publish-panel__toggle').should('be.visible');
- cy.get('.editor-post-publish-panel__toggle').click();
- cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
- cy.get('.components-panel__body:contains("Autoshare:")').click();
-
- // Check enable checkbox for auto-share.
- cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').should('be.visible');
- cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').check();
-
- // Publish.
- cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
- cy.get('.editor-post-publish-button').click();
-
- // Post-publish.
- cy.get('.autoshare-for-twitter-post-status').should('be.visible');
- cy.get('.autoshare-for-twitter-post-status').contains('Tweeted on');
- });
-
-
- it('Tests that Draft post is not tweeted when box is unchecked', () => {
- // Start create new post by enter post title
- cy.startCreatePost();
-
- // Save Draft
- cy.get('.editor-post-save-draft').should('be.visible');
- cy.get('.editor-post-save-draft').click();
- cy.get('.editor-post-saved-state').should('have.text', 'Saved');
-
- // Open pre-publish Panel.
- cy.get('.editor-post-publish-panel__toggle').should('be.visible');
- cy.get('.editor-post-publish-panel__toggle').click();
- cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
- cy.get('.components-panel__body:contains("Autoshare:")').click();
-
- // Uncheck enable checkbox for auto-share.
- cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').should('be.visible');
- cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').uncheck();
-
- // Publish.
- cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
- cy.get('.editor-post-publish-button').click();
-
- // Post-publish.
- cy.get('.autoshare-for-twitter-post-status').should('be.visible');
- cy.get('.autoshare-for-twitter-post-status').contains('This post was not tweeted.');
- });
-
+ // Run test cases with default Autoshare enabled and disabled both.
+ const defaultBehaviors = [true, false];
+ defaultBehaviors.forEach( (defaultBehavior) => {
+ it(`Can ${(defaultBehavior ? 'Enable': 'Disable')} default Autoshare`, () => {
+ cy.visit('/wp-admin/options-general.php?page=autoshare-for-twitter');
+ cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').should('exist');
+ if (true === defaultBehavior) {
+ cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').uncheck();
+ } else {
+ cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').uncheck();
+ }
+ cy.get('#submit').click();
+ });
+
+ it('Tests that new post is not tweeted when box is unchecked', () => {
+ // Start create new post by enter post title
+ cy.startCreatePost();
+
+ cy.get('.editor-post-publish-panel__toggle').should('be.visible');
+ cy.get('.editor-post-publish-panel__toggle').click();
+
+ // Publish
+ cy.get('.editor-post-publish-button').should('be.visible');
+ cy.get('.editor-post-publish-button').click();
+
+ // Post-publish.
+ cy.get('.autoshare-for-twitter-post-status').should('be.visible');
+ cy.get('.autoshare-for-twitter-post-status').contains('This post was not tweeted.');
+ });
+
+
+ it('Tests that new post is tweeted when box is checked', () => {
+ // Start create new post by enter post title
+ cy.startCreatePost();
+
+ // Open pre-publish Panel.
+ cy.get('.editor-post-publish-panel__toggle').should('be.visible');
+ cy.get('.editor-post-publish-panel__toggle').click();
+ cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
+ cy.get('.components-panel__body:contains("Autoshare:")').click();
+
+ // Check enable checkbox for auto-share.
+ cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').should('be.visible');
+ cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').check();
+
+ // Publish.
+ cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
+ cy.get('.editor-post-publish-button').click();
+
+ // Post-publish.
+ cy.get('.autoshare-for-twitter-post-status').should('be.visible');
+ cy.get('.autoshare-for-twitter-post-status').contains('Tweeted on');
+ });
+
+
+ it('Tests that Draft post is not tweeted when box is unchecked', () => {
+ // Start create new post by enter post title
+ cy.startCreatePost();
+
+ // Save Draft
+ cy.get('.editor-post-save-draft').should('be.visible');
+ cy.get('.editor-post-save-draft').click();
+ cy.get('.editor-post-saved-state').should('have.text', 'Saved');
+
+ // Open pre-publish Panel.
+ cy.get('.editor-post-publish-panel__toggle').should('be.visible');
+ cy.get('.editor-post-publish-panel__toggle').click();
+ cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
+ cy.get('.components-panel__body:contains("Autoshare:")').click();
+
+ // Uncheck enable checkbox for auto-share.
+ cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').should('be.visible');
+ cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').uncheck();
+
+ // Publish.
+ cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
+ cy.get('.editor-post-publish-button').click();
+
+ // Post-publish.
+ cy.get('.autoshare-for-twitter-post-status').should('be.visible');
+ cy.get('.autoshare-for-twitter-post-status').contains('This post was not tweeted.');
+ });
- it('Tests that Draft post is tweeted when box is checked', () => {
- // Start create new post by enter post title
- cy.startCreatePost();
-
- // Save Draft
- cy.get('.editor-post-save-draft').should('be.visible');
- cy.get('.editor-post-save-draft').click();
- cy.get('.editor-post-saved-state').should('have.text', 'Saved');
- // Open pre-publish Panel.
- cy.get('.editor-post-publish-panel__toggle').should('be.visible');
- cy.get('.editor-post-publish-panel__toggle').click();
- cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
- cy.get('.components-panel__body:contains("Autoshare:")').click();
-
- // Check enable checkbox for auto-share.
- cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').should('be.visible');
- cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').check();
-
- // Publish.
- cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
- cy.get('.editor-post-publish-button').click();
-
- // Post-publish.
- cy.get('.autoshare-for-twitter-post-status').should('be.visible');
- cy.get('.autoshare-for-twitter-post-status').contains('Tweeted on');
+ it('Tests that Draft post is tweeted when box is checked', () => {
+ // Start create new post by enter post title
+ cy.startCreatePost();
+
+ // Save Draft
+ cy.get('.editor-post-save-draft').should('be.visible');
+ cy.get('.editor-post-save-draft').click();
+ cy.get('.editor-post-saved-state').should('have.text', 'Saved');
+
+ // Open pre-publish Panel.
+ cy.get('.editor-post-publish-panel__toggle').should('be.visible');
+ cy.get('.editor-post-publish-panel__toggle').click();
+ cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
+ cy.get('.components-panel__body:contains("Autoshare:")').click();
+
+ // Check enable checkbox for auto-share.
+ cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').should('be.visible');
+ cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').check();
+
+ // Publish.
+ cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
+ cy.get('.editor-post-publish-button').click();
+
+ // Post-publish.
+ cy.get('.autoshare-for-twitter-post-status').should('be.visible');
+ cy.get('.autoshare-for-twitter-post-status').contains('Tweeted on');
+ });
});
});
\ No newline at end of file
diff --git a/tests/cypress/integration/classic-editor.test.js b/tests/cypress/integration/classic-editor.test.js
index c543f163..0bfcb373 100644
--- a/tests/cypress/integration/classic-editor.test.js
+++ b/tests/cypress/integration/classic-editor.test.js
@@ -10,67 +10,82 @@ describe('Test Autoshare for Twitter with Classic Editor.', () => {
cy.get('#submit').click();
});
- it('Tests that new post is not tweeted when box is unchecked', () => {
- // Start create post.
- cy.classicStartCreatePost();
-
- // publish
- cy.get('#publish').click();
- cy.get('#wpadminbar').should('be.visible');
-
- // Post-publish.
- cy.get('#autoshare_for_twitter_metabox').should('be.visible');
- cy.get('#autoshare_for_twitter_metabox').contains('This post was not tweeted');
- });
-
-
- it('Tests that new post is tweeted when box is checked', () => {
- // Start create post.
- cy.classicStartCreatePost();
-
- // Checkbox
- cy.get('#autoshare-for-twitter-enable').should('exist');
- cy.get('#autoshare-for-twitter-enable').check();
- cy.get('#publish').click();
-
- // Post-publish.
- cy.get('#autoshare_for_twitter_metabox',).should('be.visible');
- cy.get('#autoshare_for_twitter_metabox',).contains('Tweeted on');
- });
-
-
- it('Tests that draft post is not tweeted when box is unchecked', () => {
- // Start create post.
- cy.classicStartCreatePost();
-
- // Save Draft
- cy.get('#save-post').click();
-
- // Uncheck the checkbox and publish
- cy.get('#autoshare-for-twitter-enable').should('exist');
- cy.get('#autoshare-for-twitter-enable').uncheck();
- cy.get('#publish').click();
-
- // Post-publish.
- cy.get('#autoshare_for_twitter_metabox').should('be.visible');
- cy.get('#autoshare_for_twitter_metabox').contains('This post was not tweeted');
- });
-
-
- it('Tests that draft post is tweeted when box is checked', () => {
- // Start create post.
- cy.classicStartCreatePost();
-
- // Save Draft
- cy.get('#save-post').click();
-
- // Check the checkbox and publish
- cy.get('#autoshare-for-twitter-enable').should('exist');
- cy.get('#autoshare-for-twitter-enable').check();
- cy.get('#publish').click();
-
- // Post-publish.
- cy.get('#autoshare_for_twitter_metabox').should('be.visible');
- cy.get('#autoshare_for_twitter_metabox').contains('Tweeted on');
+ // Run test cases with default Autoshare enabled and disabled both.
+ const defaultBehaviors = [true, false];
+ defaultBehaviors.forEach( (defaultBehavior) => {
+ it(`Can ${(defaultBehavior ? 'Enable': 'Disable')} default Autoshare`, () => {
+ cy.visit('/wp-admin/options-general.php?page=autoshare-for-twitter');
+ cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').should('exist');
+ if (true === defaultBehavior) {
+ cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').uncheck();
+ } else {
+ cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').uncheck();
+ }
+ cy.get('#submit').click();
+ });
+
+ it('Tests that new post is not tweeted when box is unchecked', () => {
+ // Start create post.
+ cy.classicStartCreatePost();
+
+ // publish
+ cy.get('#publish').click();
+ cy.get('#wpadminbar').should('be.visible');
+
+ // Post-publish.
+ cy.get('#autoshare_for_twitter_metabox').should('be.visible');
+ cy.get('#autoshare_for_twitter_metabox').contains('This post was not tweeted');
+ });
+
+
+ it('Tests that new post is tweeted when box is checked', () => {
+ // Start create post.
+ cy.classicStartCreatePost();
+
+ // Checkbox
+ cy.get('#autoshare-for-twitter-enable').should('exist');
+ cy.get('#autoshare-for-twitter-enable').check();
+ cy.get('#publish').click();
+
+ // Post-publish.
+ cy.get('#autoshare_for_twitter_metabox',).should('be.visible');
+ cy.get('#autoshare_for_twitter_metabox',).contains('Tweeted on');
+ });
+
+
+ it('Tests that draft post is not tweeted when box is unchecked', () => {
+ // Start create post.
+ cy.classicStartCreatePost();
+
+ // Save Draft
+ cy.get('#save-post').click();
+
+ // Uncheck the checkbox and publish
+ cy.get('#autoshare-for-twitter-enable').should('exist');
+ cy.get('#autoshare-for-twitter-enable').uncheck();
+ cy.get('#publish').click();
+
+ // Post-publish.
+ cy.get('#autoshare_for_twitter_metabox').should('be.visible');
+ cy.get('#autoshare_for_twitter_metabox').contains('This post was not tweeted');
+ });
+
+
+ it('Tests that draft post is tweeted when box is checked', () => {
+ // Start create post.
+ cy.classicStartCreatePost();
+
+ // Save Draft
+ cy.get('#save-post').click();
+
+ // Check the checkbox and publish
+ cy.get('#autoshare-for-twitter-enable').should('exist');
+ cy.get('#autoshare-for-twitter-enable').check();
+ cy.get('#publish').click();
+
+ // Post-publish.
+ cy.get('#autoshare_for_twitter_metabox').should('be.visible');
+ cy.get('#autoshare_for_twitter_metabox').contains('Tweeted on');
+ });
});
});
\ No newline at end of file
From 020d6261a189ccfd689516720532cf54b15778ae Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Wed, 1 Jun 2022 14:56:56 +0530
Subject: [PATCH 12/26] Updated classic editor tests.
---
.../integration/classic-editor.test.js | 20 ++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/tests/cypress/integration/classic-editor.test.js b/tests/cypress/integration/classic-editor.test.js
index 0bfcb373..b0c0ccbc 100644
--- a/tests/cypress/integration/classic-editor.test.js
+++ b/tests/cypress/integration/classic-editor.test.js
@@ -11,13 +11,13 @@ describe('Test Autoshare for Twitter with Classic Editor.', () => {
});
// Run test cases with default Autoshare enabled and disabled both.
- const defaultBehaviors = [true, false];
+ const defaultBehaviors = [false, true];
defaultBehaviors.forEach( (defaultBehavior) => {
it(`Can ${(defaultBehavior ? 'Enable': 'Disable')} default Autoshare`, () => {
cy.visit('/wp-admin/options-general.php?page=autoshare-for-twitter');
cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').should('exist');
if (true === defaultBehavior) {
- cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').uncheck();
+ cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').check();
} else {
cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').uncheck();
}
@@ -28,6 +28,12 @@ describe('Test Autoshare for Twitter with Classic Editor.', () => {
// Start create post.
cy.classicStartCreatePost();
+ // Checkbox
+ const isChecked = defaultBehavior ? 'be.checked' : 'not.be.checked';
+ cy.get('#autoshare-for-twitter-enable').should('exist');
+ cy.get('#autoshare-for-twitter-enable').should(isChecked);
+ cy.get('#autoshare-for-twitter-enable').uncheck();
+
// publish
cy.get('#publish').click();
cy.get('#wpadminbar').should('be.visible');
@@ -43,8 +49,8 @@ describe('Test Autoshare for Twitter with Classic Editor.', () => {
cy.classicStartCreatePost();
// Checkbox
- cy.get('#autoshare-for-twitter-enable').should('exist');
- cy.get('#autoshare-for-twitter-enable').check();
+ const isChecked = defaultBehavior ? 'be.checked' : 'not.be.checked';
+ cy.get('#autoshare-for-twitter-enable').should('exist').should(isChecked).check();
cy.get('#publish').click();
// Post-publish.
@@ -61,7 +67,9 @@ describe('Test Autoshare for Twitter with Classic Editor.', () => {
cy.get('#save-post').click();
// Uncheck the checkbox and publish
+ const isChecked = defaultBehavior ? 'be.checked' : 'not.be.checked';
cy.get('#autoshare-for-twitter-enable').should('exist');
+ cy.get('#autoshare-for-twitter-enable').should(isChecked);
cy.get('#autoshare-for-twitter-enable').uncheck();
cy.get('#publish').click();
@@ -78,8 +86,10 @@ describe('Test Autoshare for Twitter with Classic Editor.', () => {
// Save Draft
cy.get('#save-post').click();
- // Check the checkbox and publish
+ // Uncheck the checkbox and publish
+ const isChecked = defaultBehavior ? 'be.checked' : 'not.be.checked';
cy.get('#autoshare-for-twitter-enable').should('exist');
+ cy.get('#autoshare-for-twitter-enable').should(isChecked);
cy.get('#autoshare-for-twitter-enable').check();
cy.get('#publish').click();
From 5ae511184745edbcec09ee909a8162f405d74c40 Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Wed, 1 Jun 2022 15:20:15 +0530
Subject: [PATCH 13/26] update block editor tests.
---
.../cypress/integration/block-editor.test.js | 87 +++++++++++--------
1 file changed, 51 insertions(+), 36 deletions(-)
diff --git a/tests/cypress/integration/block-editor.test.js b/tests/cypress/integration/block-editor.test.js
index dc3f6626..8d002ad8 100644
--- a/tests/cypress/integration/block-editor.test.js
+++ b/tests/cypress/integration/block-editor.test.js
@@ -1,9 +1,9 @@
describe('Test Autoshare for Twitter with Block Editor.', () => {
- before(()=>{
+ before(() => {
cy.login();
// Ignore WP 5.2 Synchronous XHR error.
Cypress.on('uncaught:exception', (err, runnable) => {
- if (err.message.includes("Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://localhost:8889/wp-admin/admin-ajax.php': Synchronous XHR in page dismissal") ){
+ if (err.message.includes("Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://localhost:8889/wp-admin/admin-ajax.php': Synchronous XHR in page dismissal") ) {
return false;
}
});
@@ -17,115 +17,130 @@ describe('Test Autoshare for Twitter with Block Editor.', () => {
});
// Run test cases with default Autoshare enabled and disabled both.
- const defaultBehaviors = [true, false];
- defaultBehaviors.forEach( (defaultBehavior) => {
- it(`Can ${(defaultBehavior ? 'Enable': 'Disable')} default Autoshare`, () => {
+ const defaultBehaviors = [false, true];
+ defaultBehaviors.forEach((defaultBehavior) => {
+ it(`Can ${defaultBehavior ? 'Enable' : 'Disable'} default Autoshare`, () => {
cy.visit('/wp-admin/options-general.php?page=autoshare-for-twitter');
- cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').should('exist');
+
+ const defaultSelector = 'input:checkbox[name="autoshare-for-twitter[enable_default]"]';
+ cy.get(defaultSelector).should('exist');
if (true === defaultBehavior) {
- cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').uncheck();
+ cy.get(defaultSelector).check();
} else {
- cy.get('input:checkbox[name="autoshare-for-twitter[enable_default]"]').uncheck();
+ cy.get(defaultSelector).uncheck();
}
cy.get('#submit').click();
});
-
+
it('Tests that new post is not tweeted when box is unchecked', () => {
// Start create new post by enter post title
cy.startCreatePost();
-
+
+ // Open pre-publish Panel.
cy.get('.editor-post-publish-panel__toggle').should('be.visible');
cy.get('.editor-post-publish-panel__toggle').click();
-
+
+ // Check enable checkbox for auto-share.
+ cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
+ cy.get('.components-panel__body:contains("Autoshare:")').click();
+
+ const checkboxSelector =
+ '.autoshare-for-twitter-prepublish__checkbox input:checkbox';
+ cy.get(checkboxSelector).should('be.visible');
+ if (true === defaultBehavior) {
+ cy.get(checkboxSelector).should('be.checked');
+ cy.get(checkboxSelector).uncheck();
+ cy.get(checkboxSelector).should('not.be.checked');
+ } else {
+ cy.get(checkboxSelector).should('not.be.checked');
+ }
+
// Publish
cy.get('.editor-post-publish-button').should('be.visible');
cy.get('.editor-post-publish-button').click();
-
+
// Post-publish.
cy.get('.autoshare-for-twitter-post-status').should('be.visible');
cy.get('.autoshare-for-twitter-post-status').contains('This post was not tweeted.');
});
-
-
- it('Tests that new post is tweeted when box is checked', () => {
+
+ it.skip('Tests that new post is tweeted when box is checked', () => {
// Start create new post by enter post title
cy.startCreatePost();
-
+
// Open pre-publish Panel.
cy.get('.editor-post-publish-panel__toggle').should('be.visible');
cy.get('.editor-post-publish-panel__toggle').click();
cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
cy.get('.components-panel__body:contains("Autoshare:")').click();
-
+
// Check enable checkbox for auto-share.
cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').should('be.visible');
cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').check();
-
+
// Publish.
cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
cy.get('.editor-post-publish-button').click();
-
+
// Post-publish.
cy.get('.autoshare-for-twitter-post-status').should('be.visible');
cy.get('.autoshare-for-twitter-post-status').contains('Tweeted on');
});
-
-
- it('Tests that Draft post is not tweeted when box is unchecked', () => {
+
+ it.skip('Tests that Draft post is not tweeted when box is unchecked', () => {
// Start create new post by enter post title
cy.startCreatePost();
-
+
// Save Draft
cy.get('.editor-post-save-draft').should('be.visible');
cy.get('.editor-post-save-draft').click();
cy.get('.editor-post-saved-state').should('have.text', 'Saved');
-
+
// Open pre-publish Panel.
cy.get('.editor-post-publish-panel__toggle').should('be.visible');
cy.get('.editor-post-publish-panel__toggle').click();
cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
cy.get('.components-panel__body:contains("Autoshare:")').click();
-
+
// Uncheck enable checkbox for auto-share.
cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').should('be.visible');
cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').uncheck();
-
+
// Publish.
cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
cy.get('.editor-post-publish-button').click();
-
+
// Post-publish.
cy.get('.autoshare-for-twitter-post-status').should('be.visible');
cy.get('.autoshare-for-twitter-post-status').contains('This post was not tweeted.');
});
-
-
- it('Tests that Draft post is tweeted when box is checked', () => {
+
+ it.skip('Tests that Draft post is tweeted when box is checked', () => {
// Start create new post by enter post title
cy.startCreatePost();
-
+
// Save Draft
cy.get('.editor-post-save-draft').should('be.visible');
cy.get('.editor-post-save-draft').click();
cy.get('.editor-post-saved-state').should('have.text', 'Saved');
-
+
// Open pre-publish Panel.
cy.get('.editor-post-publish-panel__toggle').should('be.visible');
cy.get('.editor-post-publish-panel__toggle').click();
cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
cy.get('.components-panel__body:contains("Autoshare:")').click();
-
+
// Check enable checkbox for auto-share.
cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').should('be.visible');
cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').check();
-
+
// Publish.
cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
cy.get('.editor-post-publish-button').click();
-
+
// Post-publish.
cy.get('.autoshare-for-twitter-post-status').should('be.visible');
cy.get('.autoshare-for-twitter-post-status').contains('Tweeted on');
});
});
-});
\ No newline at end of file
+});
From b4f382e415c48d442935a3e3f55b7c84a2cf8a39 Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Wed, 1 Jun 2022 18:41:24 +0530
Subject: [PATCH 14/26] Test code improvements.
---
.../cypress/integration/block-editor.test.js | 51 +++++--------------
.../integration/classic-editor.test.js | 28 ++++------
tests/cypress/support/commands.js | 32 ++++++++++++
3 files changed, 54 insertions(+), 57 deletions(-)
diff --git a/tests/cypress/integration/block-editor.test.js b/tests/cypress/integration/block-editor.test.js
index 8d002ad8..07ac887e 100644
--- a/tests/cypress/integration/block-editor.test.js
+++ b/tests/cypress/integration/block-editor.test.js
@@ -37,26 +37,13 @@ describe('Test Autoshare for Twitter with Block Editor.', () => {
cy.startCreatePost();
// Open pre-publish Panel.
- cy.get('.editor-post-publish-panel__toggle').should('be.visible');
- cy.get('.editor-post-publish-panel__toggle').click();
-
+ cy.openPrePublishPanel();
+
// Check enable checkbox for auto-share.
- cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
- cy.get('.components-panel__body:contains("Autoshare:")').click();
-
- const checkboxSelector =
- '.autoshare-for-twitter-prepublish__checkbox input:checkbox';
- cy.get(checkboxSelector).should('be.visible');
- if (true === defaultBehavior) {
- cy.get(checkboxSelector).should('be.checked');
- cy.get(checkboxSelector).uncheck();
- cy.get(checkboxSelector).should('not.be.checked');
- } else {
- cy.get(checkboxSelector).should('not.be.checked');
- }
+ cy.enableCheckbox('.autoshare-for-twitter-prepublish__checkbox input:checkbox', defaultBehavior, false);
// Publish
- cy.get('.editor-post-publish-button').should('be.visible');
+ cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
cy.get('.editor-post-publish-button').click();
// Post-publish.
@@ -64,19 +51,15 @@ describe('Test Autoshare for Twitter with Block Editor.', () => {
cy.get('.autoshare-for-twitter-post-status').contains('This post was not tweeted.');
});
- it.skip('Tests that new post is tweeted when box is checked', () => {
+ it('Tests that new post is tweeted when box is checked', () => {
// Start create new post by enter post title
cy.startCreatePost();
// Open pre-publish Panel.
- cy.get('.editor-post-publish-panel__toggle').should('be.visible');
- cy.get('.editor-post-publish-panel__toggle').click();
- cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
- cy.get('.components-panel__body:contains("Autoshare:")').click();
+ cy.openPrePublishPanel();
// Check enable checkbox for auto-share.
- cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').should('be.visible');
- cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').check();
+ cy.enableCheckbox('.autoshare-for-twitter-prepublish__checkbox input:checkbox', defaultBehavior, true);
// Publish.
cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
@@ -87,7 +70,7 @@ describe('Test Autoshare for Twitter with Block Editor.', () => {
cy.get('.autoshare-for-twitter-post-status').contains('Tweeted on');
});
- it.skip('Tests that Draft post is not tweeted when box is unchecked', () => {
+ it('Tests that Draft post is not tweeted when box is unchecked', () => {
// Start create new post by enter post title
cy.startCreatePost();
@@ -97,14 +80,10 @@ describe('Test Autoshare for Twitter with Block Editor.', () => {
cy.get('.editor-post-saved-state').should('have.text', 'Saved');
// Open pre-publish Panel.
- cy.get('.editor-post-publish-panel__toggle').should('be.visible');
- cy.get('.editor-post-publish-panel__toggle').click();
- cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
- cy.get('.components-panel__body:contains("Autoshare:")').click();
+ cy.openPrePublishPanel();
// Uncheck enable checkbox for auto-share.
- cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').should('be.visible');
- cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').uncheck();
+ cy.enableCheckbox('.autoshare-for-twitter-prepublish__checkbox input:checkbox', defaultBehavior, false);
// Publish.
cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
@@ -115,7 +94,7 @@ describe('Test Autoshare for Twitter with Block Editor.', () => {
cy.get('.autoshare-for-twitter-post-status').contains('This post was not tweeted.');
});
- it.skip('Tests that Draft post is tweeted when box is checked', () => {
+ it('Tests that Draft post is tweeted when box is checked', () => {
// Start create new post by enter post title
cy.startCreatePost();
@@ -125,14 +104,10 @@ describe('Test Autoshare for Twitter with Block Editor.', () => {
cy.get('.editor-post-saved-state').should('have.text', 'Saved');
// Open pre-publish Panel.
- cy.get('.editor-post-publish-panel__toggle').should('be.visible');
- cy.get('.editor-post-publish-panel__toggle').click();
- cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
- cy.get('.components-panel__body:contains("Autoshare:")').click();
+ cy.openPrePublishPanel();
// Check enable checkbox for auto-share.
- cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').should('be.visible');
- cy.get('.autoshare-for-twitter-prepublish__checkbox input:checkbox').check();
+ cy.enableCheckbox('.autoshare-for-twitter-prepublish__checkbox input:checkbox', defaultBehavior, true);
// Publish.
cy.get('[aria-disabled="false"].editor-post-publish-button').should('be.visible');
diff --git a/tests/cypress/integration/classic-editor.test.js b/tests/cypress/integration/classic-editor.test.js
index b0c0ccbc..363740dc 100644
--- a/tests/cypress/integration/classic-editor.test.js
+++ b/tests/cypress/integration/classic-editor.test.js
@@ -24,15 +24,12 @@ describe('Test Autoshare for Twitter with Classic Editor.', () => {
cy.get('#submit').click();
});
- it('Tests that new post is not tweeted when box is unchecked', () => {
+ it.skip('Tests that new post is not tweeted when box is unchecked', () => {
// Start create post.
cy.classicStartCreatePost();
- // Checkbox
- const isChecked = defaultBehavior ? 'be.checked' : 'not.be.checked';
- cy.get('#autoshare-for-twitter-enable').should('exist');
- cy.get('#autoshare-for-twitter-enable').should(isChecked);
- cy.get('#autoshare-for-twitter-enable').uncheck();
+ // Check enable checkbox for auto-share.
+ cy.enableCheckbox('#autoshare-for-twitter-enable', defaultBehavior, false);
// publish
cy.get('#publish').click();
@@ -44,13 +41,12 @@ describe('Test Autoshare for Twitter with Classic Editor.', () => {
});
- it('Tests that new post is tweeted when box is checked', () => {
+ it.skip('Tests that new post is tweeted when box is checked', () => {
// Start create post.
cy.classicStartCreatePost();
- // Checkbox
- const isChecked = defaultBehavior ? 'be.checked' : 'not.be.checked';
- cy.get('#autoshare-for-twitter-enable').should('exist').should(isChecked).check();
+ // Check enable checkbox for auto-share.
+ cy.enableCheckbox('#autoshare-for-twitter-enable', defaultBehavior, true);
cy.get('#publish').click();
// Post-publish.
@@ -67,10 +63,7 @@ describe('Test Autoshare for Twitter with Classic Editor.', () => {
cy.get('#save-post').click();
// Uncheck the checkbox and publish
- const isChecked = defaultBehavior ? 'be.checked' : 'not.be.checked';
- cy.get('#autoshare-for-twitter-enable').should('exist');
- cy.get('#autoshare-for-twitter-enable').should(isChecked);
- cy.get('#autoshare-for-twitter-enable').uncheck();
+ cy.enableCheckbox('#autoshare-for-twitter-enable', defaultBehavior, false);
cy.get('#publish').click();
// Post-publish.
@@ -86,11 +79,8 @@ describe('Test Autoshare for Twitter with Classic Editor.', () => {
// Save Draft
cy.get('#save-post').click();
- // Uncheck the checkbox and publish
- const isChecked = defaultBehavior ? 'be.checked' : 'not.be.checked';
- cy.get('#autoshare-for-twitter-enable').should('exist');
- cy.get('#autoshare-for-twitter-enable').should(isChecked);
- cy.get('#autoshare-for-twitter-enable').check();
+ // Check the checkbox and publish
+ cy.enableCheckbox('#autoshare-for-twitter-enable', defaultBehavior, true);
cy.get('#publish').click();
// Post-publish.
diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js
index 34485e2b..f9a48a23 100644
--- a/tests/cypress/support/commands.js
+++ b/tests/cypress/support/commands.js
@@ -42,3 +42,35 @@ Cypress.Commands.add( 'classicStartCreatePost', () => {
let postTitle = getRandomText(8);
cy.get('input[name="post_title"]').type('Random Post Title' + postTitle );
});
+
+Cypress.Commands.add( 'openPrePublishPanel', () => {
+ // Open pre-publish Panel.
+ cy.get('.editor-post-publish-panel__toggle').should('be.visible');
+ cy.get('.editor-post-publish-panel__toggle').click();
+ cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
+ cy.get('.components-panel__body:contains("Autoshare:")').click();
+});
+
+Cypress.Commands.add( 'enableCheckbox', ( checkboxSelector, defaultBehavior, check = true ) => {
+ // Check/Uncheck enable checkbox for auto-share.
+ cy.get(checkboxSelector).should('be.visible');
+ if (true === defaultBehavior) {
+ cy.get(checkboxSelector).should('be.checked');
+ } else {
+ cy.get(checkboxSelector).should('not.be.checked');
+ }
+ cy.intercept('**/autoshare/v1/post-autoshare-for-twitter-meta/*').as('enableCheckbox');
+ if (true === check) {
+ cy.get(checkboxSelector).check();
+ cy.wait('@enableCheckbox').then(response => {
+ expect(response.response?.body?.enabled).to.equal(check);
+ });
+ cy.get(checkboxSelector).should('be.checked');
+ } else {
+ cy.get(checkboxSelector).uncheck();
+ cy.wait('@enableCheckbox').then(response => {
+ expect(response.response?.body?.enabled).to.equal(check);
+ });
+ cy.get(checkboxSelector).should('not.be.checked');
+ }
+});
\ No newline at end of file
From 953e2263420590983fcc4be78ba4093d0a086987 Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Wed, 1 Jun 2022 19:36:14 +0530
Subject: [PATCH 15/26] Removed skipped tests.
---
tests/cypress/integration/classic-editor.test.js | 4 ++--
tests/cypress/support/commands.js | 16 ++++++++++------
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/tests/cypress/integration/classic-editor.test.js b/tests/cypress/integration/classic-editor.test.js
index 363740dc..3b4e8d6b 100644
--- a/tests/cypress/integration/classic-editor.test.js
+++ b/tests/cypress/integration/classic-editor.test.js
@@ -24,7 +24,7 @@ describe('Test Autoshare for Twitter with Classic Editor.', () => {
cy.get('#submit').click();
});
- it.skip('Tests that new post is not tweeted when box is unchecked', () => {
+ it('Tests that new post is not tweeted when box is unchecked', () => {
// Start create post.
cy.classicStartCreatePost();
@@ -41,7 +41,7 @@ describe('Test Autoshare for Twitter with Classic Editor.', () => {
});
- it.skip('Tests that new post is tweeted when box is checked', () => {
+ it('Tests that new post is tweeted when box is checked', () => {
// Start create post.
cy.classicStartCreatePost();
diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js
index f9a48a23..8c41f3bd 100644
--- a/tests/cypress/support/commands.js
+++ b/tests/cypress/support/commands.js
@@ -62,15 +62,19 @@ Cypress.Commands.add( 'enableCheckbox', ( checkboxSelector, defaultBehavior, che
cy.intercept('**/autoshare/v1/post-autoshare-for-twitter-meta/*').as('enableCheckbox');
if (true === check) {
cy.get(checkboxSelector).check();
- cy.wait('@enableCheckbox').then(response => {
- expect(response.response?.body?.enabled).to.equal(check);
- });
+ if(defaultBehavior !== check){
+ cy.wait('@enableCheckbox').then(response => {
+ expect(response.response?.body?.enabled).to.equal(check);
+ });
+ }
cy.get(checkboxSelector).should('be.checked');
} else {
cy.get(checkboxSelector).uncheck();
- cy.wait('@enableCheckbox').then(response => {
- expect(response.response?.body?.enabled).to.equal(check);
- });
+ if(defaultBehavior !== check){
+ cy.wait('@enableCheckbox').then(response => {
+ expect(response.response?.body?.enabled).to.equal(check);
+ });
+ }
cy.get(checkboxSelector).should('not.be.checked');
}
});
\ No newline at end of file
From 01f68e212cb7ff3a4924b134bb4b76ff94616247 Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Thu, 2 Jun 2022 12:36:29 +0530
Subject: [PATCH 16/26] Fix unchecked "Tweet this post" checkbox issue with
classic editor.
---
includes/admin/post-meta.php | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/includes/admin/post-meta.php b/includes/admin/post-meta.php
index b146761a..6d191185 100644
--- a/includes/admin/post-meta.php
+++ b/includes/admin/post-meta.php
@@ -140,7 +140,13 @@ function save_autoshare_for_twitter_meta_data( $post_id, $data ) {
// If the enable key is not set, set it to the default setting value.
if ( ! array_key_exists( ENABLE_AUTOSHARE_FOR_TWITTER_KEY, $data ) ) {
- $data[ ENABLE_AUTOSHARE_FOR_TWITTER_KEY ] = autoshare_enabled( $post_id ) ? 1 : 0;
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing
+ if ( isset( $_POST['classic-editor'] ) ) {
+ // Handle unchecked "Tweet this post" checkbox for classic editor.
+ $data[ ENABLE_AUTOSHARE_FOR_TWITTER_KEY ] = 0;
+ } else {
+ $data[ ENABLE_AUTOSHARE_FOR_TWITTER_KEY ] = autoshare_enabled( $post_id ) ? 1 : 0;
+ }
}
foreach ( $data as $key => $value ) {
From 06b8ca6ab7eaf03149e0059f420a445228f2ef21 Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Fri, 3 Jun 2022 17:51:15 +0530
Subject: [PATCH 17/26] Fix random test failure in block editor.
---
tests/cypress/support/commands.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js
index 8c41f3bd..47e34f8e 100644
--- a/tests/cypress/support/commands.js
+++ b/tests/cypress/support/commands.js
@@ -47,6 +47,7 @@ Cypress.Commands.add( 'openPrePublishPanel', () => {
// Open pre-publish Panel.
cy.get('.editor-post-publish-panel__toggle').should('be.visible');
cy.get('.editor-post-publish-panel__toggle').click();
+ cy.wait(500); // prevent clicking on category assign suggestion panel. ToDo: find more proper way to handle this.
cy.get('.components-panel__body:contains("Autoshare:")').should('exist');
cy.get('.components-panel__body:contains("Autoshare:")').click();
});
From f760324b3e9e79698b57edead01130882b51f418 Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Fri, 17 Jun 2022 16:47:17 +0530
Subject: [PATCH 18/26] Bumped version to 1.1.2
---
autoshare-for-twitter.php | 4 ++--
composer.json | 2 +-
package-lock.json | 2 +-
package.json | 2 +-
readme.txt | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/autoshare-for-twitter.php b/autoshare-for-twitter.php
index d688e768..9454b344 100644
--- a/autoshare-for-twitter.php
+++ b/autoshare-for-twitter.php
@@ -3,7 +3,7 @@
* Plugin Name: Autoshare for Twitter
* Description: Automatically tweets the post title or custom message and a link to the post.
* Disclaimer: TWITTER, TWEET, RETWEET and the Twitter logo are trademarks of Twitter, Inc. or its affiliates.
- * Version: 1.1.1
+ * Version: 1.1.2
* Requires at least: 4.9
* Requires PHP: 7.2
* Author: 10up
@@ -20,7 +20,7 @@
}
define( 'AUTOSHARE_FOR_TWITTER', __FILE__ );
-define( 'AUTOSHARE_FOR_TWITTER_VERSION', '1.1.1' );
+define( 'AUTOSHARE_FOR_TWITTER_VERSION', '1.1.2' );
define( 'AUTOSHARE_FOR_TWITTER_URL', plugin_dir_url( __FILE__ ) );
define( 'AUTOSHARE_FOR_TWITTER_PATH', plugin_dir_path( __FILE__ ) );
define( 'AUTOSHARE_FOR_TWITTER_INC', AUTOSHARE_FOR_TWITTER_PATH . 'includes/' );
diff --git a/composer.json b/composer.json
index d8170d1a..3bccea13 100644
--- a/composer.json
+++ b/composer.json
@@ -29,7 +29,7 @@
},
"minimum-stability": "dev",
"config": {
- "autoloader-suffix": "10upAutoshareForTwitterV111",
+ "autoloader-suffix": "10upAutoshareForTwitterV112",
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
diff --git a/package-lock.json b/package-lock.json
index d6f5316a..32f3e1ff 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@10up/autoshare-for-twitter",
- "version": "1.1.1",
+ "version": "1.1.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 004dbd2b..011dde96 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@10up/autoshare-for-twitter",
- "version": "1.1.1",
+ "version": "1.1.2",
"description": "Automatically tweets a post title, URL, and optional description.",
"scripts": {
"watch": "webpack -wd --config webpack.gutenberg.config.js",
diff --git a/readme.txt b/readme.txt
index ec8806ae..12c6e1de 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Tags: twitter, tweet, autoshare, auto-share, auto share, share, soc
Requires at least: 4.9
Tested up to: 6.0
Requires PHP: 7.2
-Stable tag: 1.1.1
+Stable tag: 1.1.2
License: GPL-2.0-or-later
License URI: https://spdx.org/licenses/GPL-2.0-or-later.html
From 82f07b9d5c767a2b17d916ea8a38261156eed659 Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Fri, 17 Jun 2022 17:19:01 +0530
Subject: [PATCH 19/26] Added changelog for v1.1.2
---
CHANGELOG.md | 14 ++++++++++++++
readme.txt | 8 ++++++++
2 files changed, 22 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aee22c84..fabff891 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased] - TBD
+## [1.1.2] - 2022-06-21
+### Added
+- Some addtional E2E tests (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9) via [#167](https://github.com/10up/autoshare-for-twitter/pull/167))
+- Handle publish tweets from staging/testing/local environments to prevent publishing accidental tweets. (props [@dinhtungdu](https://github.com/dinhtungdu), [@iamdharmesh](https://github.com/iamdharmesh), [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul) via [#161](https://github.com/10up/autoshare-for-twitter/pull/161))
+- Dependency security scanning. (props [@jeffpaul](https://github.com/jeffpaul), [@iamdharmesh](https://github.com/iamdharmesh) via [#160](https://github.com/10up/autoshare-for-twitter/pull/160))
+
+### Changed
+- Bump tested up to WordPress 6.0 (props [@iamdharmesh](https://github.com/iamdharmesh), [@vikrampm1](https://github.com/vikrampm1), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9) via [#162](https://github.com/10up/autoshare-for-twitter/pull/162))
+### Fixed
+- Incorrect `Tweet this post` checkbox behavior in the classic editor. (props [@iamdharmesh](https://github.com/iamdharmesh), [@cadic](https://github.com/cadic) via [#169](https://github.com/10up/autoshare-for-twitter/pull/169))
+- "Plugin asset/readme update" GH action failure. (props [@iamdharmesh](https://github.com/iamdharmesh), [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul) via [#166](https://github.com/10up/autoshare-for-twitter/pull/166) and [#165](https://github.com/10up/autoshare-for-twitter/pull/165))
+
+
## [1.1.1] - 2022-04-13
### Fixed
- If Autoshare is enabled by default, it does not consider the post-level "Tweet this post" checkbox and always tweets (props [@iamdharmesh](https://github.com/iamdharmesh), [@Sidsector9](https://github.com/Sidsector9) via [#155](https://github.com/10up/autoshare-for-twitter/pull/155)).
@@ -112,6 +125,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Initial closed source release (props [@scottlee](https://github.com/scottlee/)).
[Unreleased]: https://github.com/10up/autoshare-for-twitter/compare/trunk...develop
+[1.1.2]: https://github.com/10up/autoshare-for-twitter/compare/1.1.1...1.1.2
[1.1.1]: https://github.com/10up/autoshare-for-twitter/compare/1.1.0...1.1.1
[1.1.0]: https://github.com/10up/autoshare-for-twitter/compare/1.0.6...1.1.0
[1.0.6]: https://github.com/10up/autoshare-for-twitter/compare/1.0.5...1.0.6
diff --git a/readme.txt b/readme.txt
index 12c6e1de..afb77901 100644
--- a/readme.txt
+++ b/readme.txt
@@ -30,6 +30,14 @@ Yes, yes it does! For more details on this, see [#44](https://github.com/10up/a
== Changelog ==
+= 1.1.2 =
+* **Added:** Some addtional E2E tests (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9))
+* **Added:** Handle publish tweets from staging/testing/local environments to prevent publishing accidental tweets. (props [@dinhtungdu](https://github.com/dinhtungdu), [@iamdharmesh](https://github.com/iamdharmesh), [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul))
+* **Added:** Dependency security scanning. (props [@jeffpaul](https://github.com/jeffpaul), [@iamdharmesh](https://github.com/iamdharmesh))
+* **Changed** Bump tested up to WordPress 6.0 (props [@iamdharmesh](https://github.com/iamdharmesh), [@vikrampm1](https://github.com/vikrampm1), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9))
+* **Fixed:** Incorrect `Tweet this post` checkbox behavior in the classic editor. (props [@iamdharmesh](https://github.com/iamdharmesh), [@cadic](https://github.com/cadic))
+* **Fixed:** "Plugin asset/readme update" GH action failure. (props [@iamdharmesh](https://github.com/iamdharmesh), [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul))
+
= 1.1.1 =
* **Fixed:** If Autoshare is enabled by default, it does not consider the post-level "Tweet this post" checkbox and always tweets (props [@iamdharmesh](https://github.com/iamdharmesh), [@Sidsector9](https://github.com/Sidsector9)).
From dd46e0a4539fcb21f2212cd6994b1148b9c77afe Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Fri, 17 Jun 2022 17:21:18 +0530
Subject: [PATCH 20/26] Added contributes to credit.md file.
---
CREDITS.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CREDITS.md b/CREDITS.md
index fbea1574..443cc7b3 100644
--- a/CREDITS.md
+++ b/CREDITS.md
@@ -10,7 +10,7 @@ The following individuals are responsible for curating the list of issues, respo
Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.
-[Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Scott Lee (@scottlee)](https://github.com/scottlee), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Stephanie Campbell (@sncampbell)](https://github.com/sncampbell), [Ryan Welcher (@ryanwelcher)](https://github.com/ryanwelcher), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Lina Wiezkowiak (@linawiezkowiak)](https://github.com/linawiezkowiak), [Oszkar Nagy (@oszkarnagy)](https://github.com/oszkarnagy), [Helen Hou-Sandi (@helen)](https://github.com/helen), [Thrijith Thankachan (@thrijith)](https://github.com/thrijith), [Barney Jeffries (@barneyjeffries)](https://github.com/barneyjeffries), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [@sudip-10up](https://github.com/sudip-10up).
+[Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Scott Lee (@scottlee)](https://github.com/scottlee), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Stephanie Campbell (@sncampbell)](https://github.com/sncampbell), [Ryan Welcher (@ryanwelcher)](https://github.com/ryanwelcher), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Lina Wiezkowiak (@linawiezkowiak)](https://github.com/linawiezkowiak), [Oszkar Nagy (@oszkarnagy)](https://github.com/oszkarnagy), [Helen Hou-Sandi (@helen)](https://github.com/helen), [Thrijith Thankachan (@thrijith)](https://github.com/thrijith), [Barney Jeffries (@barneyjeffries)](https://github.com/barneyjeffries), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [@sudip-10up](https://github.com/sudip-10up), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Max Lyuchin (@cadic)](https://github.com/cadic), [Vikram Moparthy (@vikrampm1)](https://github.com/vikrampm1).
## Libraries
From 80cd633f9ce45139faf3725ef90c006717cddcb0 Mon Sep 17 00:00:00 2001
From: Jeffrey Paul
Date: Fri, 17 Jun 2022 16:04:20 -0500
Subject: [PATCH 21/26] tweak changelogs
---
CHANGELOG.md | 14 +++++++-------
readme.txt | 12 ++++++------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fabff891..f0436520 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,16 +8,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [1.1.2] - 2022-06-21
### Added
-- Some addtional E2E tests (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9) via [#167](https://github.com/10up/autoshare-for-twitter/pull/167))
-- Handle publish tweets from staging/testing/local environments to prevent publishing accidental tweets. (props [@dinhtungdu](https://github.com/dinhtungdu), [@iamdharmesh](https://github.com/iamdharmesh), [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul) via [#161](https://github.com/10up/autoshare-for-twitter/pull/161))
-- Dependency security scanning. (props [@jeffpaul](https://github.com/jeffpaul), [@iamdharmesh](https://github.com/iamdharmesh) via [#160](https://github.com/10up/autoshare-for-twitter/pull/160))
+- Cypress E2E tests (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9) via [#167](https://github.com/10up/autoshare-for-twitter/pull/167)).
+- Handle tweeting from staging/testing/local environments to prevent accidental tweets (props [@dinhtungdu](https://github.com/dinhtungdu), [@iamdharmesh](https://github.com/iamdharmesh), [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul) via [#161](https://github.com/10up/autoshare-for-twitter/pull/161)).
+- Dependency security scanning (props [@jeffpaul](https://github.com/jeffpaul), [@iamdharmesh](https://github.com/iamdharmesh) via [#160](https://github.com/10up/autoshare-for-twitter/pull/160)).
### Changed
-- Bump tested up to WordPress 6.0 (props [@iamdharmesh](https://github.com/iamdharmesh), [@vikrampm1](https://github.com/vikrampm1), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9) via [#162](https://github.com/10up/autoshare-for-twitter/pull/162))
-### Fixed
-- Incorrect `Tweet this post` checkbox behavior in the classic editor. (props [@iamdharmesh](https://github.com/iamdharmesh), [@cadic](https://github.com/cadic) via [#169](https://github.com/10up/autoshare-for-twitter/pull/169))
-- "Plugin asset/readme update" GH action failure. (props [@iamdharmesh](https://github.com/iamdharmesh), [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul) via [#166](https://github.com/10up/autoshare-for-twitter/pull/166) and [#165](https://github.com/10up/autoshare-for-twitter/pull/165))
+- Bump WordPress "tested up to" version 6.0 (props [@iamdharmesh](https://github.com/iamdharmesh), [@vikrampm1](https://github.com/vikrampm1), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9) via [#162](https://github.com/10up/autoshare-for-twitter/pull/162)).
+### Fixed
+- Incorrect `Tweet this post` checkbox behavior in the Classic Editor (props [@iamdharmesh](https://github.com/iamdharmesh), [@cadic](https://github.com/cadic) via [#169](https://github.com/10up/autoshare-for-twitter/pull/169)).
+- "Plugin asset/readme update" GitHub Action failure (props [@iamdharmesh](https://github.com/iamdharmesh), [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul) via [#166](https://github.com/10up/autoshare-for-twitter/pull/166) and [#165](https://github.com/10up/autoshare-for-twitter/pull/165)).
## [1.1.1] - 2022-04-13
### Fixed
diff --git a/readme.txt b/readme.txt
index afb77901..aab8aa25 100644
--- a/readme.txt
+++ b/readme.txt
@@ -31,12 +31,12 @@ Yes, yes it does! For more details on this, see [#44](https://github.com/10up/a
== Changelog ==
= 1.1.2 =
-* **Added:** Some addtional E2E tests (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9))
-* **Added:** Handle publish tweets from staging/testing/local environments to prevent publishing accidental tweets. (props [@dinhtungdu](https://github.com/dinhtungdu), [@iamdharmesh](https://github.com/iamdharmesh), [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul))
-* **Added:** Dependency security scanning. (props [@jeffpaul](https://github.com/jeffpaul), [@iamdharmesh](https://github.com/iamdharmesh))
-* **Changed** Bump tested up to WordPress 6.0 (props [@iamdharmesh](https://github.com/iamdharmesh), [@vikrampm1](https://github.com/vikrampm1), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9))
-* **Fixed:** Incorrect `Tweet this post` checkbox behavior in the classic editor. (props [@iamdharmesh](https://github.com/iamdharmesh), [@cadic](https://github.com/cadic))
-* **Fixed:** "Plugin asset/readme update" GH action failure. (props [@iamdharmesh](https://github.com/iamdharmesh), [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul))
+* **Added:** Cypress E2E tests (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9)).
+* **Added:** Handle tweeting from staging/testing/local environments to prevent accidental tweets (props [@dinhtungdu](https://github.com/dinhtungdu), [@iamdharmesh](https://github.com/iamdharmesh), [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul)).
+* **Added:** Dependency security scanning (props [@jeffpaul](https://github.com/jeffpaul), [@iamdharmesh](https://github.com/iamdharmesh)).
+* **Changed** Bump WordPress "tested up to" version 6.0 (props [@iamdharmesh](https://github.com/iamdharmesh), [@vikrampm1](https://github.com/vikrampm1), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9)).
+* **Fixed:** Incorrect `Tweet this post` checkbox behavior in the Classic Editor (props [@iamdharmesh](https://github.com/iamdharmesh), [@cadic](https://github.com/cadic)).
+* **Fixed:** "Plugin asset/readme update" GitHub Action failure (props [@iamdharmesh](https://github.com/iamdharmesh), [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul)).
= 1.1.1 =
* **Fixed:** If Autoshare is enabled by default, it does not consider the post-level "Tweet this post" checkbox and always tweets (props [@iamdharmesh](https://github.com/iamdharmesh), [@Sidsector9](https://github.com/Sidsector9)).
From 9fca2dfaac632c003dab1f2144510bf0a5e7e965 Mon Sep 17 00:00:00 2001
From: Jeffrey Paul
Date: Fri, 17 Jun 2022 16:08:01 -0500
Subject: [PATCH 22/26] Update CREDITS.md
---
CREDITS.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CREDITS.md b/CREDITS.md
index 443cc7b3..e71b2f6d 100644
--- a/CREDITS.md
+++ b/CREDITS.md
@@ -10,7 +10,7 @@ The following individuals are responsible for curating the list of issues, respo
Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.
-[Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Scott Lee (@scottlee)](https://github.com/scottlee), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Stephanie Campbell (@sncampbell)](https://github.com/sncampbell), [Ryan Welcher (@ryanwelcher)](https://github.com/ryanwelcher), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Lina Wiezkowiak (@linawiezkowiak)](https://github.com/linawiezkowiak), [Oszkar Nagy (@oszkarnagy)](https://github.com/oszkarnagy), [Helen Hou-Sandi (@helen)](https://github.com/helen), [Thrijith Thankachan (@thrijith)](https://github.com/thrijith), [Barney Jeffries (@barneyjeffries)](https://github.com/barneyjeffries), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [@sudip-10up](https://github.com/sudip-10up), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Max Lyuchin (@cadic)](https://github.com/cadic), [Vikram Moparthy (@vikrampm1)](https://github.com/vikrampm1).
+[Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Scott Lee (@scottlee)](https://github.com/scottlee), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Stephanie Campbell (@sncampbell)](https://github.com/sncampbell), [Ryan Welcher (@ryanwelcher)](https://github.com/ryanwelcher), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Lina Wiezkowiak (@linawiezkowiak)](https://github.com/linawiezkowiak), [Oszkar Nagy (@oszkarnagy)](https://github.com/oszkarnagy), [Helen Hou-Sandi (@helen)](https://github.com/helen), [Thrijith Thankachan (@thrijith)](https://github.com/thrijith), [Barney Jeffries (@barneyjeffries)](https://github.com/barneyjeffries), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Sudip Dadhaniya (@sudip-10up)](https://github.com/sudip-10up), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Max Lyuchin (@cadic)](https://github.com/cadic), [Vikram Moparthy (@vikrampm1)](https://github.com/vikrampm1).
## Libraries
From 10d044761e6f0e91267981cd48c7b4c436274958 Mon Sep 17 00:00:00 2001
From: Jeffrey Paul
Date: Fri, 17 Jun 2022 16:09:14 -0500
Subject: [PATCH 23/26] update contributors
---
readme.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/readme.txt b/readme.txt
index aab8aa25..3d38b2dc 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,5 +1,5 @@
=== Autoshare for Twitter ===
-Contributors: 10up, johnwatkins0, adamsilverstein, scottlee, dinhtungdu
+Contributors: 10up, johnwatkins0, adamsilverstein, scottlee, dinhtungdu, jeffpaul, dharm1025
Tags: twitter, tweet, autoshare, auto-share, auto share, share, social media
Requires at least: 4.9
Tested up to: 6.0
From e331c2ded74bed05348d9c7bd451ae5f28ea6863 Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Wed, 22 Jun 2022 18:18:45 +0530
Subject: [PATCH 24/26] Added src folder in .distignore.
---
.distignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.distignore b/.distignore
index 815f11c7..c8f38b95 100644
--- a/.distignore
+++ b/.distignore
@@ -5,6 +5,7 @@
/bin
/node_modules
/tests
+/src
# DO NOT EXCLUDE /vendor
# Files
From 0e634786336945cd6fbe17c73490a0c108e0cf91 Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Thu, 23 Jun 2022 17:10:12 +0530
Subject: [PATCH 25/26] Updated release date
---
CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f0436520..ddf0a13c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased] - TBD
-## [1.1.2] - 2022-06-21
+## [1.1.2] - 2022-06-23
### Added
- Cypress E2E tests (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9) via [#167](https://github.com/10up/autoshare-for-twitter/pull/167)).
- Handle tweeting from staging/testing/local environments to prevent accidental tweets (props [@dinhtungdu](https://github.com/dinhtungdu), [@iamdharmesh](https://github.com/iamdharmesh), [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul) via [#161](https://github.com/10up/autoshare-for-twitter/pull/161)).
From dbf1d7d6f3c6adbbff7d27ec74b2a7e61a84cb1d Mon Sep 17 00:00:00 2001
From: Dharmesh Patel
Date: Thu, 23 Jun 2022 19:48:38 +0530
Subject: [PATCH 26/26] Updated release date
---
CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ddf0a13c..b2df6839 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased] - TBD
-## [1.1.2] - 2022-06-23
+## [1.1.2] - 2022-06-24
### Added
- Cypress E2E tests (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9) via [#167](https://github.com/10up/autoshare-for-twitter/pull/167)).
- Handle tweeting from staging/testing/local environments to prevent accidental tweets (props [@dinhtungdu](https://github.com/dinhtungdu), [@iamdharmesh](https://github.com/iamdharmesh), [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul) via [#161](https://github.com/10up/autoshare-for-twitter/pull/161)).