[Utopian] Filter Resteem from User Blog

in #utopian-io6 years ago (edited)

Repository

https://github.com/steemit/condenser

New Feature

This is a feature that was recently merged and deployed into Steemit. Earlier I submitted a pull request to add the feature to filter resteemed posts from a given user's profile page. This was a long-requested feature that has various workarounds through browser extensions and handled in various alternative interfaces, but I just wanted to make it work in Steemit.

Here is how it looks when you look at the user's profile. There's a little link now that shows up when you first load the page that indicates "Hide Resteems":

filter resteem screenshot

Once clicked, it will remove the resteemed posts from the page immediately, and show up as "Show All", like so:

show all screenshot

Since all the post data is preserved, this switch is relatively insant. Now when you scroll to the bottom, if you are in the hide-resteem mode, it will fetch more posts until either a certain number of main posts are found, or an upper limit of post fetches is reached. So for example, if you go to see a resteem-only page, it will just be blank.

If every single post in the feed is a resteem, or if there's only 1 main post, it's possible that it doesn't retrigger a re-fetch until you resize, which is a slight annoyance. In the majority of the cases though, I don't expect too many problems.

Implementation

While this kind of filtering is normally something done by the database, there was no database-like backing to do such a thing, and it would likely need HiveMind support to do it in that way. So I investigated just to do something that we as end-users would end up doing anyway: repeated fetching until we finally found posts that are not resteems (if looking at a resteem-heavy profile).

If you follow my list of files: https://github.com/steemit/condenser/pull/2897/files the change boils down to a few components:

  • Link and Text, linked to the action of requesting to hide resteems, which is here. Oh dear, I forgot to localize that text!
  • Propagating the Signal to the code that performs the data fetch. This isn't anything special, you'll see in the first few files of the link that a showResteem boolean is being passed around. Something of note here is that a predicate is formed here and passed down to the data fetch code.
  • Modifying the Data fetch to perform repeat fetches until the required number of filtered posts are found, or until the max batch size limit is reached.
    • I changed the fetch into a loop here. One thing to note in this loop is that it does not discard anything. It retains all fetched posts and passes it up, and relies on the front end to actually filter it. So essentially, this simply fetches until the number of posts that match the filter fills up the batch.
    • There's a piece of code here that has a signal where if it knows there is no more data to fetch, it will signal to the top that it should wait a short period of time before requesting another fetch for the same data. It was modified to rely on the caller to pass the signal for end of data.
    • Oops. I left some unused code around, will need to clean that up! Will need to clean this up shortly
  • Code to hide the resteemed posts. That is here, which is pretty straight forward, it detects the signal for whether to hide the resteems, and checks if it is a resteem or not to decide whether not to show the item.
  • Tests, for the rest of the files. Nothing too exciting here, sets up the fetch with the filter and runs multiple cases, including the case where it fetches until a max batch size is reached.

If you are curious about any part of the change, do let me know and ask below.

GitHub Account

https://github.com/eonwarped

Sort:  

Thank you for your contribution. A nice little update for Steemit website, which is actually good for Steemians. The code looks good and its nicely explained in the post. A really like that you have added the test too.


Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @codingdefined!

So far this week you've reviewed 6 contributions. Keep up the good work!

hmmm so you are the one responsible for it! Great job man!

Although i would prefer if something like this could be done in our feeds too, cause some of the people we follow tend to make tons of resteems :P and thus the whole scrolling down and manually checking becomes quite difficult.

On the other hand don't get me wrong, i think this is a huge huge step. I keep nagging about the interface and how old and hard is with the current number of people in the platform.

So watching this made me think there is still hope so once again i am very thankful!

So it was brought up in discussion that doing it for feeds would make resteems worth almost nothing as a tool for exposure, which I do agree with. My policy there is if I see too many resteems for things I do not like, I simply unfollow. There are plenty of times where a resteem on my feed has led me to some interesting posts after all.

yes but i think there are already dapps that are doing this so eventually will be a need for that here or nobody will use that interface (not only for that reason, this is the least). I have some people 2-3 that may too many resteems but they both quality and loyal users. At the same time 1/10 times a resteem might seem useful to me so i can't unfollow these guys even if they are making my life difficult.

I don't think it will lose it's worth it will simply be a choice. if you have people like you said that led you to interesting post then there is no need and you can always switch it back. I may have no time this day and need to quickly check my feed, i will click to hide the resteems to do so and they again show them!

I see your point as well, mainly because if it were me personally I would probably turn off all resteems (even though I said they have been useful sometimes) :D. I don't know. This is a particularly contentious point among people that are proponents of resteems though, and I'm not sure what the consensus of the Steemit site code owners is. If I remember correctly though, they weren't willing to do it for feeds. I'd have to doublecheck though. This is always something that can be raised and debated though in their issue trackers.

+1 make it optional to work on feeds..

  • Some days you feel like a nut
    Sometimes you don't
    (from Mounds / Almond Joy commercial...)
    • Today I'll turn off all resteems
      Tomorrow I won't...

BTW, thanks for your coding @eonwarped. This is a very cool and needed feature!!!

Lol! I feel like I've seen that commercial and I'm not sure why but it is really weird and funny to me.

yes and as i see it it's something that will not be decided now, they have way more serious issues to solve!

Although i would prefer if something like this could be done in our feeds too, cause some of the people we follow tend to make tons of resteems :P and thus the whole scrolling down and manually checking becomes quite difficult.

I don't see why not. I second that! :)

Unfortunately it doesn't work well when there are no original non-resteemed stories in the blog visible. Infinite scrolling is then disabled, no more stories are loaded, even though there are some non-resteemed stories in the part that is not loaded yet...

Yeah... I'm aware of this part and trying to think about the right way to handle it. It's not triggering the reload in that scenario. You can get it to do it by forcing a resize or a zoom (ctrl +/ctrl -) in the meantime.

I am actually thinking about how to solve it as well, developing a web interface for Steem myself :D One possibility would be to not hide but somehow dim the stories that are resteemed. That might force the user to scroll for some time to get to original content, but at least it would work :-)

Or fetch more stories in a loop until N non-resteemed is encountered, which will obviously fetch a lot of data in case someone is only doing resteems and nothing else. It will fetch the whole blog.

Or fetch more stories in a loop until N non-resteemed is encountered

Yeah that's already happening (up to a certain limit), it just didn't trigger that logic in this special case. It will do it if it registers a scroll event that hits the bottom, but in the case where there isn't any to begin with it won't trigger. In this particular case, it might be beneficial to have a little button that forces a load, like a "load more" button.

Ha! Finally! You're a hero @eonwarped ;-)

Thank you for recommending me this link @eonwarped

Appreciate your time and effort. You're doing great job

Yours, Piotr

Starting to think if you don't fiddle on the steem frontend then we might end up having an Internet Explorer case. Thank you for making steemit just that bit more. Good job.

Well done @eonwarped! I came to your blog from GitHub, where I saw your work on the PR being merged into master a few hours ago by @roadscape. It was about time a condenser had this feature!

I saw the hide resteem option earlier and it is awesome! Thanks for working on this feature. It is sorely needed and very appreciated!

Awesome.i need this

Posted using Partiko Android

Another great contribution! It took a while to be implemented but it's still cool since I don't use steemit but busy lol

To each their own eh? I guess eventually if I just wanted to look I could use the other tool that shows full post history, come to think of it :D

At least I know that the next time I'm digging for a post in someone's profile and they have a lot of resteems it would be more efficient to just hop on to steemit :^)

Coin Marketplace

STEEM 0.16
TRX 0.16
JST 0.028
BTC 69221.02
ETH 2416.51
USDT 1.00
SBD 2.37