scorelab / Codelabz

Codelabz
Apache License 2.0
142 stars 406 forks source link

[ Fix : "Follow +" button in Tutorial View Implemented ] #1204

Open rohitPandey469 opened 8 months ago

rohitPandey469 commented 8 months ago

Description

What was happening? On clicking the follow + button at '/tutorial/tutorial_id', it wasn't doing anything. How solved it? As soon as the page loads, fetched profile data of the current user and, using getUserProfileData action which takes 'ID of the tutorial' as parameters populated the user field, then used addUserFollower and isUserFollower actions for further basic use case. While fixing the getUserProfileData action, I came across checkUserHandleExists which was finding the handle in cl_user_handle collection but a collection like this is not implemented anywhere, so I changed it to check under cl_user and instead of passing the created_by handle I am passing the uid of the user. And to get the uid of the user I stored it into the tutorials collection at the time of it's creation.

Related Issue

Fixes #1199

Motivation and Context

Dynamism

How Has This Been Tested?

Tested locally on my machine.

Video:

I created a tutorial by using codelabz user ID and then switched to Mahendar's id, then clicked on the follow + button and it stored the following and followers relation under user_followers collection.

https://github.com/scorelab/Codelabz/assets/123815256/9073d0fd-03ed-4bc2-abcc-9495511279f3

Types of changes

Checklist: