Resteemed tab
A few weeks ago, I posted about my development change to have a Resteemed tab in a user's blog. Please first see the post Resteemed Tab has been Developed! for more information.
However, an issue was found concerning pagination due to the way the change was implemented. Basically, when a user's blogroll is loaded, there is a request to the backend to return a set number of posts (currently 20 of them). Depending on which tab the user is on, the posts that belong in the other tab are hidden. The problem is that with this method, the number of blogs and the number of resteems might not be consistent. When the user scrolls to the bottom of the tab, another request is done to the backend to return the next set of 20, which again, could be a mixture of blog and resteemed posts.
The solution is to make a change to the backend to have an option of filtering blogs and resteems when requesting a user's blogroll. This way, a request for only blogs or only resteems will return a consistent number like 20 of them from the blogroll.
Lately, I've spent some time learning the steem codebase and setting up a local dev environment to be able to make changes and test them. See the Technical section below to find out the changes I've made to complete this task. You are also welcome to follow my weekly witness update posts to know what I've been up to!
Features
Blog tab
Resteemed tab
Dropdown
Technical
The two relevant API functions that needed to be changed were get_discussions_by_blog
and get_state @user
. These changes are summarized in this GitHub issue get_discussions_by_blog to filter resteems #581.
get_discussions_by_blog
Here is a regular request, which gives 20 posts, blogs and resteems mixed, as it is currently:
A new optional parameter, hide
, set to resteemed
:
With hide
set to authored
:
get_state @user
Here is the request with @user
:
With @user/blog
:
With @user/resteemed
:
Submission
The code submission can be found on these GitHub pull requests:
get_discussions_by_blog to filter resteems #678
Split Blog tab into Blog and Resteemed tabs #819