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

Add functionality to create, update, and delete issue comments #18

Merged
merged 9 commits into from
Dec 30, 2023

Conversation

RokasVaitkevicius
Copy link
Collaborator

@RokasVaitkevicius RokasVaitkevicius commented Dec 25, 2023

Type

enhancement


Description

This PR introduces the functionality to create, update, and delete issue comments in the application. It includes the following changes:

  • Added DeleteIssueCommentInput and MutationDeleteIssueCommentArgs types to support deleting issue comments.
  • Updated the IssueComments component to include UI components and functionality for creating, updating, and deleting issue comments.
  • Added an onUpdateCallback prop to the Editor component to handle editor content updates.
  • Added a new UI component, IssueComment, for rendering and editing individual issue comments.
  • Updated the IssueDescription component to use the onUpdateCallback prop and the updated mutation for creating issue comments.
  • Added new GraphQL mutations (UPDATE_ISSUE_COMMENT_MUTATION and DELETE_ISSUE_COMMENT_MUTATION) for updating and deleting issue comments.
  • Updated the hocuspocusServer to handle the commentRaw field in issue comments.
  • Added new input types (UpdateIssueCommentInput and DeleteIssueCommentInput) in the GraphQL schema to support updating and deleting issue comments.

PR changes walkthrough

Relevant files                                                                                                                                 
Enhancement
9 files
graphql.ts                                                                                                   
    frontend/gql/__generated__/graphql.ts

    Added DeleteIssueCommentInput and
    MutationDeleteIssueCommentArgs types to support deleting
    issue comments.

+41/-0
IssueComments.tsx                                                                                     
    frontend/components/IssueModal/IssueComments.tsx

    **- Added functionality to create, update, and delete issue
    comments.

    • Added UI components for creating, updating, and
      deleting issue comments.**
+159/-40
index.tsx                                                                                                     
    frontend/components/Editor/index.tsx

    **- Added onUpdateCallback prop to handle editor content
    updates.

    • Updated Editor component to use the
      onUpdateCallback prop.**
+18/-16
IssueComment.tsx                                                                                       
    frontend/components/IssueModal/IssueComment.tsx

    **- Added UI component for rendering and editing individual
    issue comments.

    • Added functionality to update and delete
      issue comments.**
+112/-0
IssueDescription.tsx                                                                               
    frontend/components/IssueModal/IssueDescription.tsx

    **- Updated Editor component to use onUpdateCallback
    prop.

    • Updated mutation to use comment instead of
      defaultContent.**
+9/-8
gql-queries-mutations.ts                                                                       
    frontend/gql/gql-queries-mutations.ts

    **- Added UPDATE_ISSUE_COMMENT_MUTATION and
    DELETE_ISSUE_COMMENT_MUTATION GraphQL mutations.

    • Updated
      CREATE_ISSUE_COMMENT_MUTATION to include commentRaw
      field.**
+17/-0
index.js                                                                                                       
    backend/src/resolvers/IssueComment/index.js

    - Added resolvers for creating, updating, and deleting issue
    comments.

+43/-1
hocuspocus-server.js                                                                               
    backend/src/services/hocuspocus-server.js

    - Updated hocuspocusServer to handle issue comment
    commentRaw field.

+5/-1
type-defs.js                                                                                               
    backend/src/type-defs.js

    - Added UpdateIssueCommentInput and
    DeleteIssueCommentInput input types.

+12/-0

@RokasVaitkevicius RokasVaitkevicius changed the title Comments update/delete functionality Issue comments update/delete functionality Dec 25, 2023
Copy link
Contributor

PR Analysis

  • 🎯 Main theme: Adding update and delete functionality for issue comments
  • 📝 PR summary: This PR introduces the ability to update and delete issue comments. It includes changes in the frontend to handle these operations, as well as updates to the backend GraphQL resolvers to perform the actual data manipulation. The PR also includes necessary updates to the GraphQL schema and mutations.
  • 📌 Type of PR: Enhancement
  • ⏱️ Estimated effort to review [1-5]: 3, because the PR includes changes in both frontend and backend, and involves GraphQL which might require a specific knowledge to review.
  • 🔒 Security concerns: No

PR Feedback

  • 💡 General suggestions: The PR seems to be well-structured and the changes are logically grouped. It's good to see that the GraphQL schema and resolvers are updated in line with the new functionality. However, it would be beneficial to include some tests to ensure the new functionality works as expected.

  • 🤖 Code feedback:
    relevant filefrontend/components/IssueModal/IssueComments.tsx
    suggestion      

    It would be good to handle potential errors when deleting or updating a comment. Currently, the promise returned by the mutation is not handled for errors. You could add a .catch block to handle any errors and provide feedback to the user. [important]

    relevant line"+ const handleDeleteIssueComment = ({ commentId }: DeleteComment) => {"

    relevant filebackend/src/resolvers.js
    suggestion      

    It's great that you're checking if the comment exists before trying to update or delete it. However, it would be good to also check if the user making the request is the one who created the comment or has the necessary permissions to perform these operations. [important]

    relevant line"+ deleteIssueComment: async (parent, { input }, { db }) => {"

    relevant filefrontend/components/IssueModal/IssueComment.tsx
    suggestion      

    It's good to see that you're using a separate component for the issue comment. However, the comment prop is typed as any. It would be better to define a type for the comment to take advantage of TypeScript's type checking. [medium]

    relevant line"+const IssueComment = ({"

    relevant filebackend/src/services/hocuspocus-server.js
    suggestion      

    It's good that you're checking if the comment exists before trying to process it. However, using return resolve(null) might be confusing as it's not a common way to resolve a promise in JavaScript. It would be clearer to just use resolve(null). [medium]

    relevant line"+ if (!comment) return resolve(null);"

    How to use

    Instructions

    To invoke the PR-Agent, add a comment using one of the following commands:
    /review: Request a review of your Pull Request.
    /describe: Update the PR title and description based on the contents of the PR.
    /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    /ask <QUESTION>: Ask a question about the PR.
    /update_changelog: Update the changelog based on the PR's contents.
    /add_docs: Generate docstring for new components introduced in the PR.
    /generate_labels: Generate labels for the PR based on the PR's contents.
    see the tools guide for more details.

    To edit any configuration parameter from the configuration.toml, add --config_path=new_value.
    For example: /review --pr_reviewer.extra_instructions="focus on the file: ..."
    To list the possible configuration parameters, add a /config comment.

@RokasVaitkevicius
Copy link
Collaborator Author

/describe

@RokasVaitkevicius
Copy link
Collaborator Author

/update_changelog

@claygorman
Copy link
Contributor

/describe

1 similar comment
@claygorman
Copy link
Contributor

/describe

@github-actions github-actions bot changed the title Issue comments update/delete functionality Add functionality to create, update, and delete issue comments Dec 30, 2023
Copy link
Contributor

PR Description updated to latest commit (8636d7d)

@github-actions github-actions bot added the enhancement New feature or request label Dec 30, 2023
@claygorman
Copy link
Contributor

/improve

@claygorman claygorman merged commit 5fb8f2f into master Dec 30, 2023
1 of 2 checks passed
@claygorman claygorman deleted the functionality-fixes branch December 30, 2023 18:52
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
None yet
Development

Successfully merging this pull request may close these issues.

2 participants