Wordpress-android: Following a feed with `/read/following/mine/new` sometimes fails

Created on 29 Sep 2020  路  10Comments  路  Source: wordpress-mobile/WordPress-Android

Expected behavior

Following/Unfollowing a feed when feedId != 0 using /read/following/mine/new works

Actual behavior

Currently only unfollowing works (in certain edge cases). Following fails with response {"info":"invalid_feed","subscribed":false}
This issue was found when testing this PR https://github.com/wordpress-mobile/WordPress-Android/pull/12960

Here's https://github.com/wordpress-mobile/WordPress-Android/pull/12960#issuecomment-699662787 is some extra information about the different logic for determining which URL to use.

Steps to reproduce the behavior

  1. Install the app with the recommended_card implemented (Suggested) <- this is easier than clicking follow in a Post header
  2. Try to follow each Site until it fails
  3. Navigate to this Site details screen and try to follow it -> it will succeed (the difference is that a different endpoint is used sites/{blog_id}/follows/new
  4. Go back and try to unfollow the Site -> it will work.
Tested on [device], Android [version], WPAndroid [version]

not related to device

New Reader Android Reader [Type] Bug

Most helpful comment

Thanks so much @AdamGrzybkowski , @bluefuton !!!

All 10 comments

Another example 9to5Google.com:
{"blog_id":146091833,"feed_id":86180988}

This feed has a feed url associated with it http://9to5google.com/feed
Screenshot 2020-09-29 at 3 43 24 PM

So the app tried to follow by feed url:
follows another site

Followed blog id above is 22427743 (feed id: 109185821) which is a private site
private site

And we're unauthorised to access it:
unauthorised

which is why I think we get an error in the mobile app.

Logs from app:
feed follow failed - {"info":"no_access","subscribed":false} - read/following/mine/new?source=android&url=http%3A%2F%2F9to5google.com%2Ffeed

Also noticed that we have two feeds with the same blog id, not sure if this is expected
/read/feed/109185821
/read/feed/86180988

cc @bluefuton

The sites that it wasn't possible to follow from the original issue (#12960) are:

  • 9to5mac.com/feed
  • 9to5google.com/feed

The blog IDs are both private, hence the no_access response. I'm assuming they don't want that content indexed in Reader. Our post recommender should respect this and skip any private sites. Site recommendations already do this.

The other site was:

  • theprettycanary.blog (now at theprettycanary.wordpress.com)

This site has moved URLs and has an out of date feed record. I've fixed it manually and the correct feed is:

https://wordpress.com/read/feeds/105000503

However, this site does not have any posts made in the last couple of years. I think we should not recommend sites that do not have any new posts in the last 12 months.

@bluefuton I also had problems with this one https://github.com/wordpress-mobile/WordPress-Android/pull/12960#issuecomment-698975017
Could you check why this was not working? It's probably one of the above reasons but it might be worth checking
Thanks!

@AdamGrzybkowski I was able to subscribe successfully to http://recliningstandards.com and it doesn't appear to be affected by either of the issues above. Do you recall what the response was from the API?

There is a reliable workaround here - always subscribe using the blog ID instead. I believe that's what Calypso Reader does when following sites via Reader Search and recommendations.

@bluefuton unfortunately, I don't :(

About subscribing with a blog ID - this was the solution proposed here but I wasn't sure if it's ok to do it that way.

@AdamGrzybkowski solution proposed here looks fine to me:

One solution to this problem could be simply using the util method from the point nr 2 instead of checking only the feedId value.

If we have a valid blogId I think it is safe to followByBlogId. It is only when we don't have a blogId when we should consider following by feedId.

It is a simple fix, right?

@ashiagr Yes, I will try to push it today/tomorrow :)

Two changes were made to the API in response to this issue:

  • we no longer recommend sites that do not have any new posts in the last 12 months (D50827-code)
  • we added a check to ensure we always exclude private sites when recommending posts (D50687-code)

Thanks so much @AdamGrzybkowski , @bluefuton !!!

Was this page helpful?
0 / 5 - 0 ratings