Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple Twitter Accounts #238

Merged
merged 40 commits into from
Jun 30, 2023
Merged

Conversation

iamdharmesh
Copy link
Member

@iamdharmesh iamdharmesh commented May 19, 2023

Description of the Change

Added support for connecting multiple Twitter Accounts and sending tweets to those accounts.

PR also, Fixes E2E tests failure by skip Twitter API calls.

Block Editor:

New Post Published Post
image image

Classic Editor:

New Post Published Post
image image
Settings:
image

Closes #230
Closes #237

How to test the Change

Backward compatibility

  1. Install and Configure current version of plugin.
  2. Checkout this PR
  3. Visit "Autoshare for Twitter" settings page or "Add new" post page.
  4. You should see 1 account connected and UI for enable tweet on it.

New features

  1. Verify that you are able to configure twitter credentials by following setup instructions
  2. After Twitter app credentials saved, UI for connect Twitter account is visible.
  3. Verify that you are able to connect more than 1 accounts.
  4. Verify that you are able to disconnect accounts
  5. Publish new post and make sure it send tweet to only tweet enabled accounts.
  6. Configure "Autoshare by default" settings for each account and verify that from create new post screen
  7. Follow steps 3-6 for classic editor and block editor both.

Changelog Entry

Added - Support for connect multiple Twitter accounts
Fixed - E2E tests by skip calling Twitter API calls

Credits

Props @iamdharmesh @jeffpaul

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@jeffpaul jeffpaul added this to the 2.1.0 milestone May 30, 2023
@iamdharmesh iamdharmesh changed the title [WIP] Add support for multiple Twitter Accounts Add support for multiple Twitter Accounts Jun 16, 2023
@iamdharmesh iamdharmesh marked this pull request as ready for review June 16, 2023 13:25
@iamdharmesh iamdharmesh requested a review from jeffpaul as a code owner June 16, 2023 13:25
@github-actions github-actions bot added the needs:code-review This requires code review. label Jun 16, 2023
@iamdharmesh iamdharmesh requested a review from a team June 16, 2023 13:26
@jeffpaul jeffpaul requested review from a team and Sidsector9 and removed request for a team and jeffpaul June 16, 2023 15:57
Copy link
Member

@Sidsector9 Sidsector9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamdharmesh thanks for this amazing work! I've requested for few changes, let me know if you'd like to discuss it over a call.

includes/admin/post-meta.php Outdated Show resolved Hide resolved
includes/admin/post-meta.php Outdated Show resolved Hide resolved
includes/admin/post-meta.php Outdated Show resolved Hide resolved
includes/admin/post-meta.php Outdated Show resolved Hide resolved
includes/class-twitter-accounts.php Outdated Show resolved Hide resolved
includes/admin/post-transition.php Outdated Show resolved Hide resolved
includes/class-twitter-accounts.php Outdated Show resolved Hide resolved
includes/class-twitter-accounts.php Outdated Show resolved Hide resolved
includes/class-twitter-accounts.php Outdated Show resolved Hide resolved
includes/class-twitter-accounts.php Outdated Show resolved Hide resolved
@iamdharmesh
Copy link
Member Author

Thanks a lot for the review and feedback @Sidsector9. I have addressed all feedback in 5a24c7d. Could you please help to re-review and confirm once?

Thanks.

@jeffpaul jeffpaul requested a review from Sidsector9 June 28, 2023 14:06
@@ -92,7 +94,7 @@ function( $post ) {
* @param int $post_id The current post ID.
* @param bool $force Publish tweet regardless of autoshare enabled or disabled on post.
*
* @return object
* @return bool|void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamdharmesh I think we should strictly set it to bool.

In case this function returns void which will evaluate to null, that null will be set here:

$message['is_retweeted'] = $is_retweeted;

In JS, we strictly check it against false here:

( ( response.success && response.data.message ) || ( false === response.success && false === response.data.is_retweeted) )

What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, not related to this PR but important enough to fix it here. Updated. Thanks

@iamdharmesh iamdharmesh requested a review from Sidsector9 June 29, 2023 14:06
@iamdharmesh iamdharmesh merged commit dd01cf7 into develop Jun 30, 2023
@iamdharmesh iamdharmesh deleted the enhancement/230 branch June 30, 2023 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-review This requires code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mock Twitter API for E2E tests Add support for linking multiple Twitter accounts
3 participants