Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 committed Jul 9, 2024
2 parents 161d145 + 0498406 commit ceccdac
Show file tree
Hide file tree
Showing 15 changed files with 1,866 additions and 19,188 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-release-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Setup node version and npm cache
uses: actions/setup-node@v3
with:
node-version: 16
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install Node dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
name: No Response
name: 'Close stale issues'

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

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

permissions:
issues: write

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

4 changes: 2 additions & 2 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/checkout@v3

- name: Download build zip
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: ${{ github.event.repository.name }}
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
cat ./tests/cypress/reports/mochawesome.md >> $GITHUB_STEP_SUMMARY
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-artifact-autoshare-for-twitter
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/deploy-to-wpdotorg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ jobs:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
- name: Upload release asset
uses: actions/upload-release-asset@v1
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{github.workspace}}/${{ github.event.repository.name }}.zip
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip
files: ${{github.workspace}}/${{ github.event.repository.name }}.zip
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v20.11.0
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased] - TBD

## [2.2.1] - 2024-07-08
### Changed
- Bump WordPress "tested up to" version 6.5 (props [@iamdharmesh](https://github.com/iamdharmesh), [@dkotter](https://github.com/dkotter), [@sudip-md](https://github.com/sudip-md), [@jeffpaul](https://github.com/jeffpaul) via [#319](https://github.com/10up/autoshare-for-twitter/pull/319)).

### Fixed
- Ampersands no longer converted to HTML entities when adding query parameters to the post URL with the `autoshare_for_twitter_post_url` filter (props [@justinmaurerdotdev](https://github.com/justinmaurerdotdev), [@iamdharmesh](https://github.com/iamdharmesh) via [#324](https://github.com/10up/autoshare-for-twitter/pull/324)).

### Security
- Bump `express` from 4.18.2 to 4.19.2 (props [@dependabot](https://github.com/apps/dependabot), [@iamdharmesh](https://github.com/iamdharmesh) via [#321](https://github.com/10up/autoshare-for-twitter/pull/321)).
- Bump `follow-redirects` from 1.15.5 to 1.15.6 (props [@dependabot](https://github.com/apps/dependabot), [@iamdharmesh](https://github.com/iamdharmesh) via [#321](https://github.com/10up/autoshare-for-twitter/pull/321)).
- Bump `ip` from 1.1.8 to 1.1.9 (props [@dependabot](https://github.com/apps/dependabot), [@iamdharmesh](https://github.com/iamdharmesh) via [#321](https://github.com/10up/autoshare-for-twitter/pull/321)).
- Bump `webpack-dev-middleware` from 5.3.3 to 5.3.4 (props [@dependabot](https://github.com/apps/dependabot), [@iamdharmesh](https://github.com/iamdharmesh) via [#321](https://github.com/10up/autoshare-for-twitter/pull/321)).

### Developer
- Cleaned up NPM dependencies and update Node to v20 (props [@Sidsector9](https://github.com/Sidsector9), [@dkotter](https://github.com/dkotter) via [#310](https://github.com/10up/autoshare-for-twitter/pull/310)).
- Upgrade `download-artifact` from v3 to v4 (props [@iamdharmesh](https://github.com/iamdharmesh) via [#316](https://github.com/10up/autoshare-for-twitter/pull/316)).
- Replaced [lee-dohm/no-response](https://github.com/lee-dohm/no-response) with [actions/stale](https://github.com/actions/stale) to help with closing no-response/stale issues (props [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter) via [#318](https://github.com/10up/autoshare-for-twitter/pull/318)).
- Added a "Testing" section in the `CONTRIBUTING.md` file (props [@kmgalanakis](https://github.com/kmgalanakis), [@jeffpaul](https://github.com/jeffpaul) via [#322](https://github.com/10up/autoshare-for-twitter/pull/322)).
- Changed from `actions/upload-release-asset` to `softprops/action-gh-release` GitHub Action (props [@Sidsector9](https://github.com/Sidsector9), [@jeffpaul](https://github.com/jeffpaul) via [#325](https://github.com/10up/autoshare-for-twitter/pull/325)).

## [2.2.0] - 2024-01-04
**Autoshare for Twitter rebranded / renamed to Autopost for X.**

Expand Down Expand Up @@ -249,6 +269,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
[2.2.1]: https://github.com/10up/autoshare-for-twitter/compare/2.2.0...2.2.1
[2.2.0]: https://github.com/10up/autoshare-for-twitter/compare/2.1.1...2.2.0
[2.1.1]: https://github.com/10up/autoshare-for-twitter/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/10up/autoshare-for-twitter/compare/2.0.0...2.1.0
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Pull requests represent a proposed solution to a specified problem. They should

For more on how 10up writes and manages code, check out our [10up Engineering Best Practices](https://10up.github.io/Engineering-Best-Practices/).

### Testing

Helping to test an open source project and provide feedback on success or failure of those tests is also a helpful contribution. You can find details on the Critical Flows and Test Cases in [this project's GitHub Wiki](https://github.com/10up/autoshare-for-twitter/wiki) as well as details on our overall approach to [Critical Flows and Test Cases in our Open Source Best Practices](https://10up.github.io/Open-Source-Best-Practices/testing/#critial-flows). Submitting the results of testing via our Critical Flows as a comment on a Pull Request of a specific feature or as an Issue when testing the entire project is the best approach for providing testing results.

## Workflow

The develop branch is the development branch which means it contains the next version to be released. `trunk` contains the latest released version as reflected in the WordPress.org plugin repository. Always work on the `develop` branch and open up PRs against `develop`.
Expand Down
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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 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), [GitHub Dependabot (@dependabot)](https://github.com/apps/dependabot), [Ravinder Kumar (@ravinderk)](https://github.com/ravinderk), [Lukasz Grzegorski (@lgrzegorski)](https://github.com/lgrzegorski), [Ben Marshall (@bmarshall511)](https://github.com/bmarshall511), [Miguel Estrada (@mae829)](https://github.com/mae829), [Rahul Prajapati (@rahulsprajapati)](https://github.com/rahulsprajapati), [@GeoffLambert77](https://github.com/GeoffLambert77), [Morgan Hartnett](https://www.morganhartnett.com/), [Justin Maurer (@justinmaurerdotdev)](https://github.com/justinmaurerdotdev), [Mikael Buxton (@sunnmagic)](https://github.com/sunnmagic).
[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), [GitHub Dependabot (@dependabot)](https://github.com/apps/dependabot), [Ravinder Kumar (@ravinderk)](https://github.com/ravinderk), [Lukasz Grzegorski (@lgrzegorski)](https://github.com/lgrzegorski), [Ben Marshall (@bmarshall511)](https://github.com/bmarshall511), [Miguel Estrada (@mae829)](https://github.com/mae829), [Rahul Prajapati (@rahulsprajapati)](https://github.com/rahulsprajapati), [@GeoffLambert77](https://github.com/GeoffLambert77), [Morgan Hartnett](https://www.morganhartnett.com/), [Justin Maurer (@justinmaurerdotdev)](https://github.com/justinmaurerdotdev), [Mikael Buxton (@sunnmagic)](https://github.com/sunnmagic), [Sudip Dadhaniya (@sudip-md)](https://github.com/sudip-md), [Konstantinos Galanakis (@kmgalanakis)](https://github.com/kmgalanakis).

## Libraries

Expand Down
4 changes: 2 additions & 2 deletions autoshare-for-twitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Autopost for X (formerly Autoshare for Twitter)
* Description: Automatically shares the post title or custom message and a link to the post to X/Twitter.
* Disclaimer: TWITTER, TWEET, RETWEET and the Twitter logo are trademarks of Twitter, Inc. or its affiliates.
* Version: 2.2.0
* Version: 2.2.1
* Requires at least: 5.7
* Requires PHP: 7.4
* Author: 10up
Expand All @@ -22,7 +22,7 @@
}

define( 'AUTOSHARE_FOR_TWITTER', __FILE__ );
define( 'AUTOSHARE_FOR_TWITTER_VERSION', '2.2.0' );
define( 'AUTOSHARE_FOR_TWITTER_VERSION', '2.2.1' );
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/' );
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"platform": {
"php": "7.4"
},
"autoloader-suffix": "10upAutoshareForTwitterV220",
"autoloader-suffix": "10upAutoshareForTwitterV221",
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
Expand Down
16 changes: 10 additions & 6 deletions includes/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

namespace TenUp\AutoshareForTwitter\Utils;

use DateTime;
use DateTimeZone;
use WP_Post;
use const TenUp\AutoshareForTwitter\Core\Admin\AT_SETTINGS;
use const TenUp\AutoshareForTwitter\Core\POST_TYPE_SUPPORT_FEATURE;
use const TenUp\AutoshareForTwitter\Core\Post_Meta\ENABLE_AUTOSHARE_FOR_TWITTER_KEY;
use const TenUp\AutoshareForTwitter\Core\Post_Meta\META_PREFIX;
Expand Down Expand Up @@ -170,7 +174,7 @@ function get_autoshare_for_twitter_settings( $key = '' ) {
'autoshare_accounts' => [],
];

$settings = get_option( \TenUp\AutoshareForTwitter\Core\Admin\AT_SETTINGS );
$settings = get_option( AT_SETTINGS );

if ( empty( $settings ) ) {
$settings = [];
Expand Down Expand Up @@ -209,11 +213,11 @@ function is_twitter_configured() {
/**
* Composes the tweet based off Title and URL.
*
* @param \WP_Post $post The post object.
* @param WP_Post $post The post object.
*
* @return string
*/
function compose_tweet_body( \WP_Post $post ) {
function compose_tweet_body( WP_Post $post ) {

/**
* Allow filtering of tweet body
Expand All @@ -227,7 +231,7 @@ function compose_tweet_body( \WP_Post $post ) {
*/
$url = apply_filters( 'autoshare_for_twitter_post_url', get_the_permalink( $post->ID ), $post );

$url = esc_url( $url );
$url = esc_url_raw( $url );
// According to this page https://developer.twitter.com/en/docs/counting-characters, all URLs are transformed to a uniform length.
$url_length = ( ! is_local() ) ? AUTOSHARE_FOR_TWITTER_URL_LENGTH : strlen( $url );
$body_max_length = 275 - $url_length; // 275 instead of 280 because of the space between body and URL and the ellipsis.
Expand Down Expand Up @@ -267,8 +271,8 @@ function date_from_twitter( $created_at ) {

$tz = get_option( 'timezone_string' );
$tz = ( ! empty( $tz ) ) ? $tz : 'UTC';
$date = new \DateTime( $created_at, new \DateTimeZone( 'UTC' ) );
$date->setTimezone( new \DateTimeZone( $tz ) );
$date = new DateTime( $created_at, new DateTimeZone( 'UTC' ) );
$date->setTimezone( new DateTimeZone( $tz ) );

return $date->format( 'Y-m-d @ g:iA' );
}
Expand Down
Loading

0 comments on commit ceccdac

Please sign in to comment.