New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: do not show when a profile follows itself #3685
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@bigint, Updated according to feedback. |
7dde6de
to
46fadc6
Compare
showFollow={ | ||
currentProfile?.id !== follower?.wallet?.defaultProfile?.id | ||
} | ||
showUnfollow={ | ||
currentProfile?.id !== follower?.wallet?.defaultProfile?.id | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can make a common props for both 🙇🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point! i'll update it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bigint Just want to double check. If we replace showFollow and showUnfollow with a common prop, (let's say showFollowUnfollow), then it would also change the behavior a bit in other places where UserProfile is used. We would show an Unfollow button in more places.
Example: I am following TeaParty. With this change I would see Unfollow button in the circle in the screenshot below. Is this desired? I think it would be an improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are for current account only right? how it will hide for other account which is not owned by you 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit hard to explain, but i'll try 🙂
First, yes, this is about when currentProfile sees a another persons profile in in a list or somewhere else at the site.
Also, this is just a small change that I wanted to mention, about the consequence of using a common boolean prop for showFollow and showUnfollow. No big change, but a slight change in behavior, as follows:
If we replace, showFollow and showUnfollow with a common prop, "showFollowUnfollow", when we will show the unfollow button in more places, for example in the circle in the screenshot. Because before, in many uses of UserProfile, we only passed showFollow as a prop (and not showUnfollow). But if we replace these with a common boolean, the logic will be the same for follow and unfollow, and thus, we will show Unfollow button on all places where we only showed Follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addition: I hope this answers your question. If not, maybe we should instead try to write test cases first, before implementing the logic? Then the expected behavior will be clear from the beginning.
Also one need to keep in mind that there are three parties involved in the logic. A: The current account, B: The account who owns the Following/Followers list, and C. The account of each profile displayed in the list. And in each case A, B and C may or may not be the same account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh i got you what you mean 🙌🏼 makes sense 🚀
What does this PR do?
If the signed-in user, appears in another user's (or in rare cases, their own) Following or Followers list, then hide the follow/unfollow button next to the signed-in user.
sceenshot
🤖 Generated by Copilot at 91f0502
This pull request fixes a bug where the user could see and follow themselves on their own profile page. It modifies the
Followers.tsx
andFollowing.tsx
components to exclude the user from the lists and actions.Related issues
Fixes #3683
Type of change
Explanation of the changes
🤖 Generated by Copilot at 91f0502
Followers.tsx
andFollowing.tsx
to prevent the user from seeing themselves as a follower or following of their own profile (link, link)Followers.tsx
andFollowing.tsx
to prevent the user from following or unfollowing themselves (link, link)useAppStore
hook inFollowing.tsx
to get the current profile from the app state (link, link)Emoji
🚫🛠️🗃️