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

Fixes Twitter publicize connections #9629

Merged
merged 4 commits into from
Apr 16, 2019

Conversation

oguzkocer
Copy link
Contributor

Fixes #8652.

When we tried to add a new publicize connection with the /sites/$site/publicize-connections/new endpoint, it complained with the following error:

This Publicize service does not support setting an external user ID.

This is easily reproducible by:

  1. Create a few twitter connections from any client
  2. Make a request to v1.1/me/keyring-connections/
  3. Pick a Twitter connection from the results
  4. Use the ID of it as keyring_connection_ID and external_ID of it as external_user_ID and make a request to /sites/$site/publicize-connections/new for any of your sites. You can also use the /me/publicize-connections/new to create a connection for all of your sites
  5. Notice the error This Publicize service does not support setting an external user ID.

I checked Calypso and they are not sending the external_user_ID at all for Twitter connections. (They also send the parameters as a json object but that doesn't seem to make a difference) I initially tried to remove the external_user_ID for all connection requests, but Facebook does expect it and since #8652 says the issue only affects Twitter, the most straightforward solution is to not send the external_user_ID parameter for it.


To test:

  • Connect multiple Twitter accounts from My Site -> Sharing -> Twitter
  • Try connecting to other services
  • Try disconnecting/reconnecting the twitter accounts

In my test I was able to connect 2 different Twitter accounts without any issues and a Facebook account once I add a page to my test Facebook account. I don't have a handy test account for LinkedIn or Tumblr, but this PR shouldn't change anything about them. If anyone has it handy, it'd be good to test them just in case.

Finally, I found an issue with the Facebook connections which I'll create a new issue for.


Update release notes:

  • If there are user facing changes, I have added an item to RELEASE-NOTES.txt.

@@ -161,7 +161,8 @@ public void onErrorResponse(VolleyError volleyError) {

Map<String, String> params = new HashMap<>();
params.put("keyring_connection_ID", Long.toString(keyringConnectionId));
if (!externalUserId.isEmpty()) {
// Sending the external id for Twitter connections result in an error
if (!externalUserId.isEmpty() && !serviceId.equals(PublicizeConstants.TWITTER_ID)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

wdyt about using TextUils.isEmpty(externalUserId) and PublicizeConstants.TWITTER_ID.equals(serviceId) to avoid potential NPEs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ha, I have been in Kotlin world for too long, good catch! I'll make the change later today.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in dc81204.

Copy link
Contributor

@mzorz mzorz left a comment

Choose a reason for hiding this comment

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

Tested, works as advertised, LGTM!
Left a note on potential NPE so, after that's addressed, feel free to :shipit:
Approving

@oguzkocer
Copy link
Contributor Author

@mzorz I've addressed the possible NPE issue and merged develop into this branch to resolve the conflict for the release notes. This should be ready for a second round, thanks!

@mzorz
Copy link
Contributor

mzorz commented Apr 16, 2019

Thanks for this @oguzkocer ! Will merge once CircleCI goes 💚

@mzorz mzorz merged commit 3e5b88f into develop Apr 16, 2019
@mzorz mzorz deleted the issue/8652-fix-publicize-connections branch April 16, 2019 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publicize: Error Connecting To Social Media Profiles
2 participants