This week I got the “unfollow” button working on the Followers table. While I was at it, I was working on trying to get the “follow” button to disappear on the Users table so that nobody could try to follow a given user more than once. After doing some research, it seemed like the best plan of action would be to only have a user show up in the Users table or the Followers table, but not both. So I had to spend some time trying to get ChatGPT to help me write a join query or a subquery to filter out the users you already follow and exclude them from the Users table. I was able to get this functionality working: When the logged in user follows someone, they are removed from their Users table but appear in the Followers table. If they unfollow a given user, they are removed from the Followers table and appear back in the Users table.
ChatGPT was helpful in getting me onto the right path thinking about a sub query to filter out followed users we don’t want to show up in the Users table. I had to spend some time crafting my question/query to ChatGPT to get this right, but I wasn’t able to fully achieve it without an understanding of queries because I had to make some manual adjustments to get it working correctly.
Up next: I noticed we have a few asynchronous callouts and on the frontend, it’s not clear if we are waiting on something to happen or not. The next feature I’d want to implement is adding a loading icon or a spinner to all async calls to let the user know something is happening and they’ll know they are waiting on an action to be completed.
Link to PR: https://github.com/aicoders-osu/osu_467_aicoder/pull/23
The below screenshot shows an example of what I got working. You will notice Harry Potter, Kevin Test1, test Kozub, and Test Testing do not show up in the top “User Table” but they show up in the “Following table”.
Leave a Reply