scorelab / Codelabz

Codelabz
Apache License 2.0
144 stars 410 forks source link

[ Fix : Stored the commented_user Id and Used it to Show Avatar ] #1211

Open rohitPandey469 opened 6 months ago

rohitPandey469 commented 6 months ago

Description

  1. Created a new profile_action getCurrentUserData to fetch user data in TutorialPage component.
  2. Passed the userId to CommentBox component, and update the userId field in commentData to store real userId got from props and then the addComment action get called. Now, the comments have their userId and we can use it to fetch the userData.
  3. Then In Comment component the real userId passed into User component.
  4. Here called the getUserProfileData with the userId and fetched the value and used it to show Avatar.

Now, fetching it inside the component doesn't seem good but we are using the same component for every Avatar's so I am thinking of sending the user data directly into the component. Well, it's something I am just thinking

Related Issue

Fixes #1198

Motivation and Context

Fixing the Avatars so I can differentiate who wrote which/what/why comments.

How Has This Been Tested?

Locally On my machine.

Video:

https://github.com/scorelab/Codelabz/assets/123815256/b9e94567-b32b-4eb5-acd2-c42fa363f2e5

Types of changes

Checklist: