Support channel definitions from /file/list_homepage #1049

Closed
opened 2018-02-26 22:19:03 +01:00 by kauffj · 4 comments
kauffj commented 2018-02-26 22:19:03 +01:00 (Migrated from github.com)

Modify doFetchFeaturedUris to support working for channels.

Currently, the following URL returns the content to be displayed on the app homepage:

https://api.lbry.io/file/list_homepage

If the object key begins with an @ (indicating a channel) and the listed content array is empty, doFetchFeaturedUris should call channel_list to return the 10 most recent items in that channel.

Additionally, if the object key begins with an @, the subscribe button should be shown next to the channel name.

Modify `doFetchFeaturedUris` to support working for channels. Currently, the following URL returns the content to be displayed on the app homepage: https://api.lbry.io/file/list_homepage If the object key begins with an `@` (indicating a channel) and the listed content array is empty, `doFetchFeaturedUris` should call `channel_list` to return the 10 most recent items in that channel. Additionally, if the object key begins with an `@`, the subscribe button should be shown next to the channel name.
kauffj commented 2018-02-26 22:28:28 +01:00 (Migrated from github.com)

@reillysmith

@reillysmith
daovist commented 2018-02-28 15:11:24 +01:00 (Migrated from github.com)

So I dug into doFetchFeaturedUris and got down to lbry.js and jsonrpc.js and now understand much better what all is going on. It took me a while to grok that Proxy mechanics are handling methods not explicitly stated in lbry.js. I think @kauffj meant claim_list_by_channel rather than channel_list as I was able to hit that endpoint on the daemon with Postman. I see two ways of doing this.

A) modify doFetchFeaturedUris to also include channelsToResolve; use an if statement to update URI and channel lists accordingly
B) use Lbry.claim_list_by_channel to get URIs for each channel name
C) put relevant data into urisToResolve
D) and let doResolveUris get the claim info for channel content along with the rest of the featured content it's already grabbing

or 2) call doFetchClaimsByChannel in the 1A if statement when the category is a channel and sort it all out in the view

I think 1 is simpler from a data model perspective but would be slower because there may be multiple channels each of which would make its own RPC before making the one big RPC for all the info. I think 2 would be faster but more complex putting the data back together.

I also think I may be overthinking this. Please advise.

@seanyesmunt @liamcardenas

So I dug into `doFetchFeaturedUris` and got down to `lbry.js` and `jsonrpc.js` and now understand much better what all is going on. It took me a while to grok that Proxy mechanics are handling methods not explicitly stated in `lbry.js`. I think @kauffj meant `claim_list_by_channel` rather than `channel_list` as I was able to hit that endpoint on the daemon with Postman. I see two ways of doing this. 1) A) modify [doFetchFeaturedUris](https://github.com/lbryio/lbry-app/blob/master/src/renderer/redux/actions/content.js#L72) to also include `channelsToResolve`; use an if statement to update URI and channel lists accordingly B) use `Lbry.claim_list_by_channel` to get URIs for each channel name C) put relevant data into `urisToResolve` D) and let `doResolveUris` get the claim info for channel content along with the rest of the featured content it's already grabbing or 2) call `doFetchClaimsByChannel` in the 1A if statement when the category is a channel and sort it all out in the view I think 1 is simpler from a data model perspective but would be slower because there may be multiple channels each of which would make its own RPC before making the one big RPC for all the info. I think 2 would be faster but more complex putting the data back together. I also think I may be overthinking this. Please advise. @seanyesmunt @liamcardenas
kauffj commented 2018-02-28 16:26:35 +01:00 (Migrated from github.com)

@daovist yes, I did mean claim_list_by_channel.

I agree these are the two approaches. Approach 2 is probably more "proper" or "React-like".

That is:

  1. Refactor FeaturedCategory to be a standalone component.
  2. If FeaturedCategory receives a channel name but no URIs, call out to doFetchClaimsByChannel to receive them.

It may make sense to refactor other arguments here a bit as well (e.g. FeaturedCategory takes "names" currently, but "uris" is a more appropriate term).

You can look at page/channel for inspiration.

@daovist yes, I did mean `claim_list_by_channel`. I agree these are the two approaches. Approach 2 is probably more "proper" or "React-like". That is: 1. Refactor `FeaturedCategory` to be a standalone component. 2. If `FeaturedCategory` receives a channel name but no URIs, call out to `doFetchClaimsByChannel` to receive them. It may make sense to refactor other arguments here a bit as well (e.g. `FeaturedCategory` takes "names" currently, but "uris" is a more appropriate term). You can look at `page/channel` for inspiration.
tzarebczan commented 2018-06-21 07:48:35 +02:00 (Migrated from github.com)
Fixed in : https://github.com/lbryio/lbry-app/pull/1267
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
LBRYCommunity/lbry-desktop#1049
No description provided.