# Implementing the comments adding feature

**URL:** https://sef.discourse.group/t/implementing-the-comments-adding-feature/377
**Category:** ScholarX
**Created:** [January 12, 2022, 7:05am UTC](https://sef.discourse.group/t/implementing-the-comments-adding-feature/377 "2022-01-12T07:05:21Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)
#### Post date: [January 12, 2022, 7:05am UTC](https://sef.discourse.group/t/implementing-the-comments-adding-feature/377/1 "2022-01-12T07:05:21Z")

</div>

I started working on adding the comments adding feature. Which will be helpful for admins and mentors when they are reviewing the applications. This thread will be used to keep everyone updated with my progress. I already created the relevant issues on Github.

> <https://github.com/sef-global/scholarx-frontend/issues/293>
>
> \*\*Is your feature request related to a problem? Please describe.\*\*
> \- As a mento…r or an admin I should be able to add comments on a mentee
> 
> \*\*Describe the solution you'd like\*\*
> \- Update admin and mentor dashboards with comments feature

> <https://github.com/sef-global/scholarx/issues/282>
>
> \*\*Is your feature request related to a problem? Please describe.\*\*
> \- As a mento…r or an admin I should be able to add comments on a mentee
> 
> \*\*Describe the solution you'd like\*\*
> \- Create endpoints to perform the CRUD operations
> \- Mentee shouldn't be allowed or to access or see the comments

---

<div class="post-metadata">

### Author: ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)
#### Post date: [January 12, 2022, 7:17am UTC](https://sef.discourse.group/t/implementing-the-comments-adding-feature/377/2 "2022-01-12T07:17:30Z")

</div>

**Backtend**  
Here’s the draft PR along with the new comments table. The relationship is `A profile can add many comments on a mentee`. @piumal1999 @Gravewalker @jaye Can I have some feedback on this?

> <https://github.com/sef-global/scholarx/pull/283>
>
> \## Purpose
> 
> The purpose of this PR is to fix #282 
> 
> \## Goals
> 
> 
> \## Approac…h
> 
> 
> \### Screenshots
> 
> 
> \## Checklist
> \- \[x\] This PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.
> \- \[x\] I have read and understood the development best practices guidelines ( http://bit.ly/sef-best-practices )
> \- \[x\] My code follows the style guidelines of this project
> \- \[x\] I have performed a self-review of my own code
> \- \[\] I have commented my code, particularly in hard-to-understand areas
> \- \[\] I have made corresponding changes to the documentation
> 
> \## Related PRs
>  
> 
> \## Test environment
>  
> 
> \## Learning

 ![scholarxDB](https://global.discourse-cdn.com/free1/uploads/sef/original/1X/912b77ce80842845aa10c822a70d3228f8f7f9f4.png)

**Frontend**  
I’m halfway into integrating the APIs with the admin UI

 ![Screenshot 2022-01-12 at 12.44.32 PM](https://global.discourse-cdn.com/free1/uploads/sef/original/1X/841f5fb9baad82ed2a8a8f9fc0eca8297036b70f.png)

---

<div class="post-metadata">

### Author: ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)
#### Post date: [January 12, 2022, 8:04am UTC](https://sef.discourse.group/t/implementing-the-comments-adding-feature/377/3 "2022-01-12T08:04:59Z")

</div>

Thanks for the update @anjisvj!

You are heading on the right path. Please add `created_at` field to the comment table. So that we can know when they commented. You could rename the profile\_id field into something more readable. ex: commented\_by, commented\_profile\_id

Regarding the UI, we don’t need to display two sections, Comments by mentor and comments by admin. Let’s display all of them using the [antd’s list component](https://ant.design/components/list/) with their profile picture, name and time. (We could show their role later)

@piumal1999 @Gravewalker What do you think?

---

<div class="post-metadata">

### Author: ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)
#### Post date: [January 12, 2022, 8:07am UTC](https://sef.discourse.group/t/implementing-the-comments-adding-feature/377/4 "2022-01-12T08:07:57Z")

</div>

Thanks for the feedback! I’ll update the columns.  
Regarding the UI your way is perfect. I was struggling with the UI. xD

---

<div class="post-metadata">

### Author: ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)
#### Post date: [January 12, 2022, 1:54pm UTC](https://sef.discourse.group/t/implementing-the-comments-adding-feature/377/5 "2022-01-12T13:54:15Z")

</div>

Here the Admin UI

 ![Screenshot 2022-01-12 at 7.23.36 PM](https://global.discourse-cdn.com/free1/uploads/sef/original/1X/e999d04a14e63b3f1cdc6609b2a379033d105409.png)

Are we going to show the admin comments to the mentor? Are we going to enable comments throughout the program?  
@jaye @Dharana_J

---

<div class="post-metadata">

### Author: ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)
#### Post date: [January 13, 2022, 5:38am UTC](https://sef.discourse.group/t/implementing-the-comments-adding-feature/377/6 "2022-01-13T05:38:22Z")

</div>

Let’s make it visible to both parties. So that they can use it as a communication method. But we should make sure to indicate to users that comments are visible to other admins and relevant mentors. We can add a visibility feature later enabling them to add private comments (ex: only me, admins only, …)

For the design, I would suggest something like the. following: (Only if we have sufficient time)

 ![Screenshot 2022-01-13 at 11.07.05](https://global.discourse-cdn.com/free1/uploads/sef/original/1X/23774758a4eb44cb796d60eda59f6ddc8658a581.png)

To display that time ago thing, there’s a tiny library named [javascript-time-ago](https://www.npmjs.com/package/javascript-time-ago)

---

<div class="post-metadata">

### Author: ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)
#### Post date: [January 13, 2022, 7:44am UTC](https://sef.discourse.group/t/implementing-the-comments-adding-feature/377/7 "2022-01-13T07:44:19Z")

</div>

Thanks for the suggestion. @jaye  
Made the changes.

 ![image](https://global.discourse-cdn.com/free1/uploads/sef/original/1X/0314b1026424497132174bd40c53ff85867f2648.png)

---

<div class="post-metadata">

### Author: ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)
#### Post date: [January 13, 2022, 8:02am UTC](https://sef.discourse.group/t/implementing-the-comments-adding-feature/377/8 "2022-01-13T08:02:40Z")

</div>

Awesome!

The comments can be deleted only by the one who commented.

A suggestion:  
It would be nice if we could move the delete option to the view more menu shown in the example I provided. Later we can add the edit option to the same menu. (The menu icon should only be displayed in front of their own comments)

 ![Screenshot 2022-01-13 at 13.31.59](https://global.discourse-cdn.com/free1/uploads/sef/original/1X/8534c5486a8e2e2d9ac4e4ecf2ff67faa1a51ca4.png)

---

<div class="post-metadata">

### Author: ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)
#### Post date: [January 13, 2022, 12:36pm UTC](https://sef.discourse.group/t/implementing-the-comments-adding-feature/377/9 "2022-01-13T12:36:59Z")

</div>

I made the requested changes.  
The PRs are ready for review:

> <https://github.com/sef-global/scholarx-frontend/pull/294>
>
> \## Purpose
> 
> \- The purpose of this PR is to fix #293 
> 
> \## Goals
> 
> \- Mentors… and Admins should be able to add/delete comments
> 
> \## Approach
> 
> \- Create the comments section component
> 
> \## Screenshots
> 
> !\[image\](https://user-images.githubusercontent.com/43912578/149330465-0db7a3ce-2327-4bf9-aa97-ed01222f690f.png)
> 
> \## Checklist
> \- \[x\] This PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.
> \- \[x\] I have read and understood the development best practices guidelines ( http://bit.ly/sef-best-practices )
> \- \[x\] My code follows the style guidelines of this project
> \- \[x\] I have performed a self-review of my own code
> \- \[\] I have commented my code, particularly in hard-to-understand areas
> \- \[\] I have made corresponding changes to the documentation

> <https://github.com/sef-global/scholarx/pull/283>
>
> \## Purpose
> 
> \- The purpose of this PR is to fix #282 
> 
> \## Goals
> 
> \- Mentors …and Admins should be able to add/delete comments
> \## Approach
> 
> \- Create CRUD enpoints
> \- Create comment model, service and repository
> 
> \## Checklist
> \- \[x\] This PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.
> \- \[x\] I have read and understood the development best practices guidelines ( http://bit.ly/sef-best-practices )
> \- \[x\] My code follows the style guidelines of this project
> \- \[x\] I have performed a self-review of my own code
> \- \[\] I have commented my code, particularly in hard-to-understand areas
> \- \[\] I have made corresponding changes to the documentation
