UserPosts Followupdates the following avl.Tree with a FollowingInfo structure which includes the followed user's latest post ID. This is so that the home posts only include posts of another user after starting to follow them. Normally, Follow is only called once to follow another user. The problem is that if it is called a second time, then it will update with a new FollowingInfo which replaces the previous one. This could result in to showing some followed posts which were made after the initial call to Follow.
This PR solves this problem by checking if the other user is already being followed. If yes, then do nothing.
UserPosts
Follow
updates thefollowing
avl.Tree with aFollowingInfo
structure which includes the followed user's latest post ID. This is so that the home posts only include posts of another user after starting to follow them. Normally,Follow
is only called once to follow another user. The problem is that if it is called a second time, then it will update with a newFollowingInfo
which replaces the previous one. This could result in to showing some followed posts which were made after the initial call toFollow
.This PR solves this problem by checking if the other user is already being followed. If yes, then do nothing.