Skip to content

Commit 75feda4

Browse files
committed
Merge branch 'develop' into trunk
2 parents af4b3b3 + 8beebe2 commit 75feda4

17 files changed

+496
-165
lines changed

.distignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/bin
66
/node_modules
77
/tests
8+
/src
89
# DO NOT EXCLUDE /vendor
910

1011
# Files
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependency Review Action
2+
#
3+
# 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.
4+
#
5+
# Source repository: https://github.com/actions/dependency-review-action
6+
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
7+
name: 'Dependency Review'
8+
on: [pull_request]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
dependency-review:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: 'Checkout Repository'
18+
uses: actions/checkout@v3
19+
- name: 'Dependency Review'
20+
uses: actions/dependency-review-action@v1

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased] - TBD
88

9+
## [1.1.2] - 2022-06-24
10+
### Added
11+
- 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)).
12+
- 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)).
13+
- 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)).
14+
15+
### Changed
16+
- 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)).
17+
18+
### Fixed
19+
- 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)).
20+
- "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)).
21+
922
## [1.1.1] - 2022-04-13
1023
### Fixed
1124
- 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/),
112125
- Initial closed source release (props [@scottlee](https://github.com/scottlee/)).
113126

114127
[Unreleased]: https://github.com/10up/autoshare-for-twitter/compare/trunk...develop
128+
[1.1.2]: https://github.com/10up/autoshare-for-twitter/compare/1.1.1...1.1.2
115129
[1.1.1]: https://github.com/10up/autoshare-for-twitter/compare/1.1.0...1.1.1
116130
[1.1.0]: https://github.com/10up/autoshare-for-twitter/compare/1.0.6...1.1.0
117131
[1.0.6]: https://github.com/10up/autoshare-for-twitter/compare/1.0.5...1.0.6

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The `develop` branch is the development branch which means it contains the next
2929
## Release instructions
3030

3131
1. Branch: Starting from `develop`, cut a release branch named `release/X.Y.Z` for your changes.
32-
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.
32+
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.
3333
1. Changelog: Add/update the changelog in `CHANGELOG.md` and `readme.txt`.
3434
1. Props: update `CREDITS.md` with any new contributors, confirm maintainers are accurate.
3535
1. New files: Check to be sure any new files/paths that are unnecessary in the production version are included in `.distignore`.

CREDITS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The following individuals are responsible for curating the list of issues, respo
1010

1111
Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.
1212

13-
[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).
13+
[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).
1414

1515
## Libraries
1616

autoshare-for-twitter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Autoshare for Twitter
44
* Description: Automatically tweets the post title or custom message and a link to the post.
55
* Disclaimer: TWITTER, TWEET, RETWEET and the Twitter logo are trademarks of Twitter, Inc. or its affiliates.
6-
* Version: 1.1.1
6+
* Version: 1.1.2
77
* Requires at least: 4.9
88
* Requires PHP: 7.2
99
* Author: 10up
@@ -20,7 +20,7 @@
2020
}
2121

2222
define( 'AUTOSHARE_FOR_TWITTER', __FILE__ );
23-
define( 'AUTOSHARE_FOR_TWITTER_VERSION', '1.1.1' );
23+
define( 'AUTOSHARE_FOR_TWITTER_VERSION', '1.1.2' );
2424
define( 'AUTOSHARE_FOR_TWITTER_URL', plugin_dir_url( __FILE__ ) );
2525
define( 'AUTOSHARE_FOR_TWITTER_PATH', plugin_dir_path( __FILE__ ) );
2626
define( 'AUTOSHARE_FOR_TWITTER_INC', AUTOSHARE_FOR_TWITTER_PATH . 'includes/' );

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
},
3030
"minimum-stability": "dev",
3131
"config": {
32+
"autoloader-suffix": "10upAutoshareForTwitterV112",
3233
"allow-plugins": {
3334
"dealerdirect/phpcodesniffer-composer-installer": true
3435
}

includes/admin/post-meta.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,13 @@ function save_autoshare_for_twitter_meta_data( $post_id, $data ) {
140140

141141
// If the enable key is not set, set it to the default setting value.
142142
if ( ! array_key_exists( ENABLE_AUTOSHARE_FOR_TWITTER_KEY, $data ) ) {
143-
$data[ ENABLE_AUTOSHARE_FOR_TWITTER_KEY ] = autoshare_enabled( $post_id ) ? 1 : 0;
143+
// phpcs:ignore WordPress.Security.NonceVerification.Missing
144+
if ( isset( $_POST['classic-editor'] ) ) {
145+
// Handle unchecked "Tweet this post" checkbox for classic editor.
146+
$data[ ENABLE_AUTOSHARE_FOR_TWITTER_KEY ] = 0;
147+
} else {
148+
$data[ ENABLE_AUTOSHARE_FOR_TWITTER_KEY ] = autoshare_enabled( $post_id ) ? 1 : 0;
149+
}
144150
}
145151

146152
foreach ( $data as $key => $value ) {

includes/admin/post-transition.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace TenUp\AutoshareForTwitter\Core\Post_Transition;
99

1010
use TenUp\AutoshareForTwitter\Core\Publish_Tweet\Publish_Tweet;
11+
use TenUp\AutoshareForTwitter\Core\AST_Staging\AST_Staging;
1112
use TenUp\AutoshareForTwitter\Core\Post_Meta as Meta;
1213
use TenUp\AutoshareForTwitter\Utils as Utils;
1314
use function TenUp\AutoshareForTwitter\Utils\delete_autoshare_for_twitter_meta;
@@ -40,27 +41,32 @@ function setup() {
4041
* @return object
4142
*/
4243
function maybe_publish_tweet( $new_status, $old_status, $post ) {
43-
/**
44+
/*
4445
* Add filter to return early based on post or status
4546
*/
4647
if ( apply_filters( 'autoshare_for_twitter_disable_on_transition_post_status', false, $post, $old_status, $new_status ) ) {
4748
return;
4849
}
4950

50-
/**
51+
/*
5152
* We're only interested in posts that are transitioning into publish.
5253
*/
5354
if ( 'publish' !== $new_status || 'publish' === $old_status ) {
5455
return;
5556
}
5657

57-
/**
58+
/*
5859
* Don't bother enqueuing assets if the post type hasn't opted into autosharing
5960
*/
6061
if ( ! Utils\opted_into_autoshare_for_twitter( $post->ID ) ) {
6162
return;
6263
}
6364

65+
// Don't publish tweets from staging/testing sites.
66+
if ( ! AST_Staging::is_production_site() ) {
67+
return;
68+
}
69+
6470
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
6571
add_action(
6672
sprintf( 'rest_after_insert_%s', $post->post_type ),
@@ -86,19 +92,24 @@ function( $post ) {
8692
function publish_tweet( $post_id ) {
8793
$post = get_post( $post_id );
8894

89-
/**
95+
/*
9096
* Don't bother enqueuing assets if the post type hasn't opted into autosharing
9197
*/
9298
if ( ! Utils\opted_into_autoshare_for_twitter( $post->ID ) ) {
9399
return;
94100
}
95101

102+
// Don't publish tweets from staging/testing sites.
103+
if ( ! AST_Staging::is_production_site() ) {
104+
return;
105+
}
106+
96107
// Ensure we have a $post object.
97108
if ( ! $post ) {
98109
return;
99110
}
100111

101-
/**
112+
/*
102113
* One final check: was the "auto tweet" checkbox selected?
103114
*/
104115
if ( Utils\autoshare_enabled( $post->ID ) ) {

0 commit comments

Comments
 (0)