Greenshift 023: Additional Fixes

in #greenshift6 years ago

This time I wanted to prevent relationships from grabbing comments once and for all. And hopefully I have gotten that fixed. Here's how I went about fixing the relationships that still suffered from this issue.

First off, we already have fixed this issue with regards to the first relationship. That was the one where we grabbed the author's most recent post. In the code for that relationship, we actually checked whether or not the comment had a parent or not. Only if the post had no parent would we accept the comment as a post:


Greenshift 23-3.png

We simply called the parent_author field from the comment operation. Unfortunately for us, other operations like voting don't have this field. Thus we are not able to simply perform this filter. We need to get the actual comment using the permlink in order to get the comment information which has the parent_author field. Here's how that looks in our most recent relationship:


Greenshift 23-1.png

Since, we are querying the blockchain for the comment in this case, this check is rather trivial to add here. In our other relationships, this is not the case. In our other relationships, we need to add a query of the blockchain for a specific piece of content and then perform the check on that retrieved content. This looks like the following:


Greenshift 23-2.png

I basically applied these changes to the remaining relationships and now we should be good in terms of retrieving posts only. Whereas we only explicitly checked in the first relationship, we are now checking in every relationship. Granted the code is correct, this implementation should guarantee that permlinks of comments are no longer retrieved. Next time, we begin to identify some sloppy code and optimize things a little bit before moving on.

Sort:  

This post has been just added as new item to timeline of Q-Filter on Steem Projects.

If you want to be notified about new updates from this project, register on Steem Projects and add Q-Filter to your favorite projects.

Coin Marketplace

STEEM 0.25
TRX 0.20
JST 0.036
BTC 96147.07
ETH 3525.13
USDT 1.00
SBD 3.45