Skip to content
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

Added Follow Feature to User Profile (Backend & Frontend Integration) #438

Merged
merged 8 commits into from
Nov 9, 2024

Conversation

IkkiOcean
Copy link
Contributor

Description:

I implemented a follow/unfollow feature on the user profile page. This will allow users to follow other users and see their followers/following counts. The feature includes both backend controller logic to manage user relationships and frontend integration to allow users to follow/unfollow others directly from their profile.

Changes made

Backend (Controller & API Logic):

  • Create a toggleFollowUser controller to handle follow/unfollow actions.
  • The controller should:
  • Accept a userId from the logged-in user and a targetUserId from the request parameters.
  • Check if the logged-in user is already following the target user.
  • If following, remove the user from the logged-in user's following list and vice versa.
  • If not following, add the user to the logged-in user's following list and vice versa.
  • Update the follower and following counts for both users.
  • Return the updated counts and a success message upon completion.
  • Update the User model if necessary to include the necessary fields (followers and following arrays).

Frontend (Profile Integration):

  • Create a button on the user profile page for the follow/unfollow action.

    • Display the button as Follow if the logged-in user is not following the target user.
    • Change the button to Following if the logged-in user is already following the target user.
  • Call the backend API to toggle the follow/unfollow status when the button is clicked.

  • Display the updated follower and following counts dynamically.

  • Add loading states or error handling for the follow/unfollow action.

  • Closes FEATURE: Create User Profile Page and Follow Feature #424

video

rf.mp4

Copy link

netlify bot commented Nov 9, 2024

Deploy Preview for delightful-daifuku-a9f6ea ready!

Name Link
🔨 Latest commit
🔍 Latest deploy log https://app.netlify.com/sites/delightful-daifuku-a9f6ea/deploys/672f9cd3b3d66481dd3f176d
😎 Deploy Preview https://deploy-preview-438--delightful-daifuku-a9f6ea.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@AlfiyaSiddique
Copy link
Owner

@IkkiOcean, can you change the profile page's red background as we discussed before?

@IkkiOcean
Copy link
Contributor Author

@IkkiOcean, can you change the profile page's red background as we discussed before?

I added a gradient to it. what should I change it to?

@AlfiyaSiddique
Copy link
Owner

@IkkiOcean can see the gradient because the deployment failed due to a syntax error:
image

@AlfiyaSiddique
Copy link
Owner

Please fix it

@IkkiOcean
Copy link
Contributor Author

Please fix it

that must be a merge conflict cause.
btw is this image good as the background
image

@IkkiOcean
Copy link
Contributor Author

Screenshot 2024-11-09 at 6 29 35 PM

@AlfiyaSiddique I think this looks good

@AlfiyaSiddique
Copy link
Owner

Yeah for now we can go with this, please make the changes

@IkkiOcean
Copy link
Contributor Author

@AlfiyaSiddique I completed the changes

@AlfiyaSiddique AlfiyaSiddique added gssoc-ext For GSSOC Extended Contribution. level 3 GSSOC level 3 Contribution - 50 points hacktoberfest-accepted labels Nov 9, 2024
@AlfiyaSiddique AlfiyaSiddique merged commit b4726ad into AlfiyaSiddique:master Nov 9, 2024
5 checks passed
Copy link

github-actions bot commented Nov 9, 2024

🎉 Thank you @IkkiOcean Your pull request has been successfully merged! 🎉 Thank you for your contribution to our project. Your efforts are greatly appreciated. Keep up the fantastic work! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gssoc-ext For GSSOC Extended Contribution. hacktoberfest-accepted level 3 GSSOC level 3 Contribution - 50 points
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FEATURE: Create User Profile Page and Follow Feature
2 participants