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

[ENHANCEMENT] Comment section for every post #9

Closed
10 of 11 tasks
SethCram opened this issue Jan 29, 2023 · 0 comments
Closed
10 of 11 tasks

[ENHANCEMENT] Comment section for every post #9

SethCram opened this issue Jan 29, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@SethCram
Copy link
Owner

SethCram commented Jan 29, 2023

Is your feature request related to a problem? Please describe.

  • Yes, feedback can't be left on posts

Describe the solution you'd like

  • Comment section for every post
    • located below the post on singlepostpage
    • should include username of person who posted comment
    • each comment should be upvotable/downvotable by those w/ enough reputation
    • poster should be able to mark whether a comment was helpful/reasonable
      • if so, the commenter should receive reputation points
    • anybody should be able to make comments + reply to another person's comment
  • All comments should be linkable back to user who made them

Additional context

  • reputation system needs implementing beforehand
  • should I create a new "comment" model
    • then each post model would have an array of comments

Development

  • comment model

    • username to link to author
    • reputation + badgeName
    • postID to get all of a posts comments
    • replyID to link to replied comment
  • comment api methods

    • needa create, get all, get by id, update, delete
      • only author should be able to update or delete
      • get by id to reply to other comments
      • during comment retrieval, should also return comment being replied to if exists
        • didn't do this
        • not sure how to display on frontend
    • changed comment creation
      • to also link a created comment to its replied to comment's replies arr
      • but only does a single level, so iteratively finds root comment
    • changed get all comments
      • now retrieve all comments that arent replying to other comments
      • so, can render the replies under each root comment
  • add query all comments author'd by a user

  • implement list of comments on frontend

    • located below the post on singlepostpage
    • should include username of person who posted comment
      • each comment should be upvotable/downvotable
    • just like creation of post, creation of comment should be customizable thru an editor
    • should have a "reply" button
      • which should store the replied comment's id locally
      • and attach repliers username to top of comment
      • displayed thru storing the index of the selected comment and checking if it's the one within map()
  • update ReputationIcon to take comment

    • had to make further margin adjustments for number centering
    • so passed in a class
  • allow for creation of brand new comment

    • as comment on original post at top of comment section
    • could potentially make it into a function instead of comp or just html
      • since reused to 2 separate spots
    • after posting comment, needed to refresh displayed comments so just re-retrieve from DB
      • but required moving getComments() outside of useEffect
  • visually display replied to comments below root comment

    • had to restructure Comment model to contain an array of reply comments
      • made mapping way easier
    • also displayed whoever replying to username within comment
  • make comment into a react functional component

    • can't refetch all comments if dont know when submitting a new comment
      • so, will have to create local comments and store them with their corresponding render index/parent objectId
      • wrong
    • will likely need to create a "CommentSection" component too
    • created both comment and comment section components
    • comment section needed to know:
      • what comment being replied to for rendering text box location by id
    • new comment template needed to know:
      • comment being replied to username for rendering + submission
      • comment being replied to id for submission
    • cleared out comment template once comment submitted
      • if a reply comment submitted
  • allow replying to other comments

    • had to communicate tween react comps via passing in a parent funct handle to its child
  • allow voting on comments

    • copy + pasted post voting functionality
      • have to handleVote() in separate way
    • should prolly remove hover altogether
      • did so for posts and comments
    • generalized the api method for updatedLinkedModel fairly easily
      • since Comment and Post had fields such as "reputation" and "badgeName" named the same
  • allow editing of author'd comment

    • similar to editing of post
    • implemented a comment-specific write mode enabled upon update btn press
@SethCram SethCram added the enhancement New feature or request label Jan 29, 2023
@SethCram SethCram self-assigned this Jan 29, 2023
@SethCram SethCram added the help wanted Extra attention is needed label Mar 10, 2023
@SethCram SethCram removed the help wanted Extra attention is needed label Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

1 participant