{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":709069948,"defaultBranch":"main","name":"agent-protocol-jira","ownerLogin":"twilwa","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2023-10-24T00:25:50.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/111034762?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1698169505.0","currentOid":""},"activityList":{"items":[{"before":"d9cb971761a01a6c4191e93448c1df599a54712f","after":"efe53b3d4544bcc046a5c13b06a0559570457be2","ref":"refs/heads/main","pushedAt":"2023-10-28T20:30:06.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"twilwa","name":null,"path":"/twilwa","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/111034762?s=80&v=4"},"commit":{"message":"new day, catchup for aider","shortMessageHtmlLink":"new day, catchup for aider"}},{"before":"0c8428444a867b82c2e3aff8a60e2f030bf9cf36","after":"d9cb971761a01a6c4191e93448c1df599a54712f","ref":"refs/heads/main","pushedAt":"2023-10-25T03:01:39.000Z","pushType":"push","commitsCount":8,"pusher":{"login":"twilwa","name":null,"path":"/twilwa","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/111034762?s=80&v=4"},"commit":{"message":"starting point for aider","shortMessageHtmlLink":"starting point for aider"}},{"before":"ac7e36cff710a1311d68ecccd63f6c16b9edfa3c","after":"0c8428444a867b82c2e3aff8a60e2f030bf9cf36","ref":"refs/heads/main","pushedAt":"2023-10-24T19:05:42.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"twilwa","name":null,"path":"/twilwa","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/111034762?s=80&v=4"},"commit":{"message":"add autopr","shortMessageHtmlLink":"add autopr"}},{"before":"901d5b3c61c7ed522baab70a4cf06e25b1590b9e","after":"ac7e36cff710a1311d68ecccd63f6c16b9edfa3c","ref":"refs/heads/main","pushedAt":"2023-10-24T18:50:14.000Z","pushType":"push","commitsCount":2,"pusher":{"login":"twilwa","name":null,"path":"/twilwa","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/111034762?s=80&v=4"},"commit":{"message":"aider: Added functionality to add and delete comments in `agent-protocol-handler/src/index.jsx`.\n\n# Aider chat conversation:\n\nUSER: hey can you modify our `agent-protocol-handler/src/index.jsx`\n\nASSISTANT: Sure, I'd be happy to help. Could you please specify what modifications you would like to make to the `agent-protocol-handler/src/index.jsx` file?\n\nUSER: let's modify `agent-protocol-handler/src/index.jsx` to include the functionality to delete or add comments in addition to fetching them for a given issue.\n\nASSISTANT: Alright, to add the functionality to add and delete comments, we will need to modify the `agent-protocol-handler/src/index.jsx` file.\n\nHere are the steps we will follow:\n\n1. We will add a new function `addCommentForIssue` that will make a POST request to the Jira API to add a comment to a specific issue.\n2. We will modify the `App` component to include buttons for adding and deleting comments, and text fields to input the comment text and ID.\n\nHere are the changes:\n\n```jsx\nagent-protocol-handler/src/index.jsx\n<<<<<<< HEAD\nimport ForgeUI, { render, Fragment, Text, IssuePanel } from '@forge/ui';\nimport api, { route } from \"@forge/api\";\nimport ForgeUI, { render, Fragment, Text, IssuePanel, useProductContext } from \"@forge/ui\";\n=======\nimport ForgeUI, { render, Fragment, Text, IssuePanel, Button, TextField, useProductContext } from \"@forge/ui\";\nimport api, { route } from \"@forge/api\";\n>>>>>>> updated\n```\n\n```jsx\nagent-protocol-handler/src/index.jsx\n<<<<<<< HEAD\nconst deleteCommentForIssue = async (issueIdOrKey, commentId) => {\n const res = await api\n .asUser()\n .requestJira(route`/rest/api/3/issue/${issueIdOrKey}/comment/${commentId}`, {\n method: 'DELETE',\n });\n\n if (!res.ok) {\n throw new Error(`Failed to delete comment with id ${commentId} for issue ${issueIdOrKey}`);\n }\n};\n=======\nconst addCommentForIssue = async (issueIdOrKey, commentBody) => {\n const res = await api\n .asUser()\n .requestJira(route`/rest/api/3/issue/${issueIdOrKey}/comment`, {\n method: 'POST',\n body: JSON.stringify({\n body: commentBody,\n }),\n });\n\n if (!res.ok) {\n throw new Error(`Failed to add comment to issue ${issueIdOrKey}`);\n }\n};\n\nconst deleteCommentForIssue = async (issueIdOrKey, commentId) => {\n const res = await api\n .asUser()\n .requestJira(route`/rest/api/3/issue/${issueIdOrKey}/comment/${commentId}`, {\n method: 'DELETE',\n });\n\n if (!res.ok) {\n throw new Error(`Failed to delete comment with id ${commentId} for issue ${issueIdOrKey}`);\n }\n};\n>>>>>>> updated\n```\n\n```jsx\nagent-protocol-handler/src/index.jsx\n<<<<<<< HEAD\nconst App = () => {\n return (\n \n Hello world!\n \n );\n};\n=======\nconst App = () => {\n const { platformContext: { issueKey } } = useProductContext();\n const [commentBody, setCommentBody] = useState('');\n const [commentId, setCommentId] = useState('');\n\n const handleAddComment = async () => {\n await addCommentForIssue(issueKey, commentBody);\n setCommentBody('');\n };\n\n const handleDeleteComment = async () => {\n await deleteCommentForIssue(issueKey, commentId);\n setCommentId('');\n };\n\n return (\n \n Add or delete comments\n \n