Ulogs.org "My Ulogs" Tab

in utopian-io •  26 days ago

Repository

https://github.com/surpassinggoogle/UlogsV2

Task Request

https://steemit.com/@surpassinggoogle/task-request-kindly-create-a-new-tab-on-ulogs-org-per-user-profile-called-my-ulogs-that-displays-only-posts-per-user-profile

Pull Request

https://github.com/surpassinggoogle/UlogsV2/pull/92

The above task request asked for someone to add a new tab for the user's Ulog posts to the user profile page.

My Ulogs Tab

Commit: https://github.com/surpassinggoogle/UlogsV2/pull/92/commits/b2491f3cf44f513da77c08b51310da15c0ddb3a2

To add the tab I copied the UserProfile.js, renamed it to UserUlogs.js and added a new route.
In UserMenu.js I added the new tab.

Filter

Commit: https://github.com/surpassinggoogle/UlogsV2/pull/92/commits/c24d345a890006b5e7ac2e7d4d1cbb7c8bf30d2b

The requirement was to just show posts from a user that have #ulog as the first tag. This is a bit problematic since the Steem API does not provide a way to get results filtered by username and tag at the same time. So the results need to be filtered after they are retrieved from the blockchain.
This filtering is of course not hard to implement but it raises an issue related to the lazy loading mechanic of the post list. I explained the issue here in a comment.

TODO: This way the infinite scroll does not work. This is a temporary solution!
Reason: The hasMore check in feedReducer.js:63 is not reliable because the number of returned posts, due to this filtering below, will most of the times be lower than the limit parameter, even though there might be more #ulog posts in the next result set.
Ugly Solution: Return here not only the #ulog posts but also the number of all posts that were returned by the API. The hasMore check could then refer to that instead of the number of #ulog posts.

Anyway... to make this work I first had to add an ulog state property in the FeedReducer.js and add this case to the stateHelpers.js.

I set the limit parameter to 100, so that as many ulog posts as possible are fetched and I adjusted the UserUlogs.js to actually use the ulog state property.

That's it!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

What can i say, @mkt was great. He was brotherly among other things. The task turned out a more complicated task than appeared and and could easily have been deemed totally impossible but @mkt readily brainstormed a workaround, educating me in the process. I am hoping as many reach out to him for their tasks. Another thing, he communicates and i tell you, in many cases communication solves almost as many challenges as the coding. I am grateful overall

·

Thanks a lot @mkt for your great post on topic @ulog and also thanks my boss @surpassinggoogle

Posted using Partiko Android

·

Ok... Wow.... thank you for those nice words! :)

·
·

Welcome all brother

Posted using Partiko Android

Congratulations @mkt! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes received

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Hey, @mkt!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!