payload: {"action":"created","comment":{"url":"https://api.github.com/repos/attivio/suit/pulls/comments/303639123","pull_request_review_id":262078315,"id":303639123,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMwMzYzOTEyMw==","diff_hunk":"@@ -0,0 +1,272 @@\n+// @flow\n+import React from 'react';\n+import PropTypes from 'prop-types';\n+import { Modal, Button, Col, Row, Glyphicon } from 'react-bootstrap';\n+\n+import QueryResponse from '../api/QueryResponse';\n+import AuthUtils from '../util/AuthUtils';\n+import SimpleQueryRequest from '../api/SimpleQueryRequest';\n+\n+type CommentsProps = {\n+  /** The document's ID, needed for adding/removing comments */\n+  docId: string,\n+  /** Optional. The table name to be used for comments document stored in the index */\n+  commentsTable?: string,\n+}\n+\n+type CommentsDefaultProps = {\n+  commentsTable: string,\n+}\n+\n+type CommentsState = {\n+  comment: string;\n+  response: QueryResponse | null;\n+  error: string | null;\n+  showCommentModal: boolean,\n+  commentList: Array<any>,\n+}\n+\n+class Comments extends React.Component<CommentsDefaultProps, CommentsProps, CommentsState> {\n+  static contextTypes = {\n+    searcher: PropTypes.any,\n+  };\n+\n+  static defaultProps = {\n+    commentsTable: 'comments',\n+  };\n+\n+  static displayName = 'Comments';\n+\n+  constructor(props) {\n+    super(props);\n+    this.state = {\n+      comment: '',\n+      response: null,\n+      error: null,\n+      showCommentModal: false,\n+      commentList: [],\n+    };\n+    (this: any).showCommentModal = this.showCommentModal.bind(this);\n+    (this: any).hideCommentModal = this.hideCommentModal.bind(this);\n+    (this: any).captureComment = this.captureComment.bind(this);\n+    (this: any).saveComment = this.saveComment.bind(this);\n+    (this: any).clearComment = this.clearComment.bind(this);\n+    (this: any).getComments = this.getComments.bind(this);\n+    (this: any).deleteComment = this.deleteComment.bind(this);\n+  }\n+\n+  componentDidMount() {\n+    this.getComments();\n+  }\n+\n+  getComments() {\n+    const { searcher } = this.context;\n+    const { docId, commentsTable } = this.props;\n+    if (searcher) {\n+      const qr = new SimpleQueryRequest();\n+      qr.query = `AND(table:${commentsTable}, docId_s:FACET(\"${docId}\"))`;\n+      qr.facets = [];\n+      qr.queryLanguage = 'advanced';\n+      searcher.doCustomSearch(qr, (response: QueryResponse | null, error: string | null) => {\n+        if (response) {\n+          this.setState(\n+            {\n+              response,\n+              comment: '',\n+            },\n+            this.populateComments,\n+          );\n+        } else if (error) {\n+          this.setState({\n+            error,\n+          });\n+        }\n+      });\n+    }\n+  }\n+\n+  deleteComment(id: string) {\n+    const jsonDoc = `{ \"id\" : \"${id}\", \"mode\" : \"DELETE\" }`;\n+    this.context.searcher.search.addOrDeleteDocument(JSON.parse(jsonDoc), this.getComments);\n+  }\n+\n+  populateComments() {\n+    const { response } = this.state;\n+    const loggedInUser = AuthUtils.getUserName(AuthUtils.getSavedUser());\n+    if (response) {\n+      const commentList = [];\n+      response.documents.forEach((doc) => {","path":"src/components/Comments.js","position":98,"original_position":98,"commit_id":"1438d5293313ff70171f64d266a7acae44351067","original_commit_id":"1438d5293313ff70171f64d266a7acae44351067","user":{"login":"klk1010","id":12201276,"node_id":"MDQ6VXNlcjEyMjAxMjc2","avatar_url":"https://avatars0.githubusercontent.com/u/12201276?v=4","gravatar_id":"","url":"https://api.github.com/users/klk1010","html_url":"https://github.com/klk1010","followers_url":"https://api.github.com/users/klk1010/followers","following_url":"https://api.github.com/users/klk1010/following{/other_user}","gists_url":"https://api.github.com/users/klk1010/gists{/gist_id}","starred_url":"https://api.github.com/users/klk1010/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klk1010/subscriptions","organizations_url":"https://api.github.com/users/klk1010/orgs","repos_url":"https://api.github.com/users/klk1010/repos","events_url":"https://api.github.com/users/klk1010/events{/privacy}","received_events_url":"https://api.github.com/users/klk1010/received_events","type":"User","site_admin":false},"body":"The response formatting should be done in a generic location. We follow a pattern of saving requests in the `api` directory - as you did - and also creating a js class created from the result. `api/SimplePrincipal` is an example of this. If you do that on line 71 so that instead of storing `response` in state directly, you're storing `commentList`, which would be: `Array<Comment>`, then here you could just map the result and `Comment` would be it's own `.js` file and class that could potentially be used elsewhere.","created_at":"2019-07-15T21:13:59Z","updated_at":"2019-07-15T21:13:59Z","html_url":"https://github.com/attivio/suit/pull/138#discussion_r303639123","pull_request_url":"https://api.github.com/repos/attivio/suit/pulls/138","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/attivio/suit/pulls/comments/303639123"},"html":{"href":"https://github.com/attivio/suit/pull/138#discussion_r303639123"},"pull_request":{"href":"https://api.github.com/repos/attivio/suit/pulls/138"}}},"pull_request":{"url":"https://api.github.com/repos/attivio/suit/pulls/138","id":297217680,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjk3MjE3Njgw","html_url":"https://github.com/attivio/suit/pull/138","diff_url":"https://github.com/attivio/suit/pull/138.diff","patch_url":"https://github.com/attivio/suit/pull/138.patch","issue_url":"https://api.github.com/repos/attivio/suit/issues/138","number":138,"state":"open","locked":false,"title":"issue-137: Adds an option to add comments on a Search Result","user":{"login":"nikhilj13","id":31805650,"node_id":"MDQ6VXNlcjMxODA1NjUw","avatar_url":"https://avatars1.githubusercontent.com/u/31805650?v=4","gravatar_id":"","url":"https://api.github.com/users/nikhilj13","html_url":"https://github.com/nikhilj13","followers_url":"https://api.github.com/users/nikhilj13/followers","following_url":"https://api.github.com/users/nikhilj13/following{/other_user}","gists_url":"https://api.github.com/users/nikhilj13/gists{/gist_id}","starred_url":"https://api.github.com/users/nikhilj13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikhilj13/subscriptions","organizations_url":"https://api.github.com/users/nikhilj13/orgs","repos_url":"https://api.github.com/users/nikhilj13/repos","events_url":"https://api.github.com/users/nikhilj13/events{/privacy}","received_events_url":"https://api.github.com/users/nikhilj13/received_events","type":"User","site_admin":false},"body":"Adds the functionality to add/view comments on a search result.\r\n\r\nHere's an example where I'm adding and deleting a comment:\r\n![comment](https://user-images.githubusercontent.com/31805650/61228478-5b917080-a6f4-11e9-8ecb-69cfce78f87c.gif)\r\n\r\nThe comments are stored in the index and the users would be able to enable/disable comments and specify the table name for comment documents in the Index. These options would be configurable from the SearchUI's configuration.properties file. Below is an example:\r\n```\r\n// These properties configure the tags/options shown for each of the list search results\r\n  SearchResultTags: {\r\n\t  // Whether to show an option to add/view comments for a search result. False by default.\r\n\t  comments: false,\r\n\t  // Specify the table field for the comment documents in the index. 'comments' by default.\r\n\t  commentsTable: 'comments'\r\n  },\r\n``` ","created_at":"2019-07-12T20:44:12Z","updated_at":"2019-07-15T21:13:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fa7990032af3b59958e815d41e78ec3450072f5a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/attivio/suit/pulls/138/commits","review_comments_url":"https://api.github.com/repos/attivio/suit/pulls/138/comments","review_comment_url":"https://api.github.com/repos/attivio/suit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/attivio/suit/issues/138/comments","statuses_url":"https://api.github.com/repos/attivio/suit/statuses/1438d5293313ff70171f64d266a7acae44351067","head":{"label":"nikhilj13:comments","ref":"comments","sha":"1438d5293313ff70171f64d266a7acae44351067","user":{"login":"nikhilj13","id":31805650,"node_id":"MDQ6VXNlcjMxODA1NjUw","avatar_url":"https://avatars1.githubusercontent.com/u/31805650?v=4","gravatar_id":"","url":"https://api.github.com/users/nikhilj13","html_url":"https://github.com/nikhilj13","followers_url":"https://api.github.com/users/nikhilj13/followers","following_url":"https://api.github.com/users/nikhilj13/following{/other_user}","gists_url":"https://api.github.com/users/nikhilj13/gists{/gist_id}","starred_url":"https://api.github.com/users/nikhilj13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikhilj13/subscriptions","organizations_url":"https://api.github.com/users/nikhilj13/orgs","repos_url":"https://api.github.com/users/nikhilj13/repos","events_url":"https://api.github.com/users/nikhilj13/events{/privacy}","received_events_url":"https://api.github.com/users/nikhilj13/received_events","type":"User","site_admin":false},"repo":{"id":183275580,"node_id":"MDEwOlJlcG9zaXRvcnkxODMyNzU1ODA=","name":"suit","full_name":"nikhilj13/suit","private":false,"owner":{"login":"nikhilj13","id":31805650,"node_id":"MDQ6VXNlcjMxODA1NjUw","avatar_url":"https://avatars1.githubusercontent.com/u/31805650?v=4","gravatar_id":"","url":"https://api.github.com/users/nikhilj13","html_url":"https://github.com/nikhilj13","followers_url":"https://api.github.com/users/nikhilj13/followers","following_url":"https://api.github.com/users/nikhilj13/following{/other_user}","gists_url":"https://api.github.com/users/nikhilj13/gists{/gist_id}","starred_url":"https://api.github.com/users/nikhilj13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikhilj13/subscriptions","organizations_url":"https://api.github.com/users/nikhilj13/orgs","repos_url":"https://api.github.com/users/nikhilj13/repos","events_url":"https://api.github.com/users/nikhilj13/events{/privacy}","received_events_url":"https://api.github.com/users/nikhilj13/received_events","type":"User","site_admin":false},"html_url":"https://github.com/nikhilj13/suit","description":"Attivio Search UI Toolkit (SUIT) is a library for creating search clients for searching the Attivio platform.","fork":true,"url":"https://api.github.com/repos/nikhilj13/suit","forks_url":"https://api.github.com/repos/nikhilj13/suit/forks","keys_url":"https://api.github.com/repos/nikhilj13/suit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nikhilj13/suit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nikhilj13/suit/teams","hooks_url":"https://api.github.com/repos/nikhilj13/suit/hooks","issue_events_url":"https://api.github.com/repos/nikhilj13/suit/issues/events{/number}","events_url":"https://api.github.com/repos/nikhilj13/suit/events","assignees_url":"https://api.github.com/repos/nikhilj13/suit/assignees{/user}","branches_url":"https://api.github.com/repos/nikhilj13/suit/branches{/branch}","tags_url":"https://api.github.com/repos/nikhilj13/suit/tags","blobs_url":"https://api.github.com/repos/nikhilj13/suit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nikhilj13/suit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nikhilj13/suit/git/refs{/sha}","trees_url":"https://api.github.com/repos/nikhilj13/suit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nikhilj13/suit/statuses/{sha}","languages_url":"https://api.github.com/repos/nikhilj13/suit/languages","stargazers_url":"https://api.github.com/repos/nikhilj13/suit/stargazers","contributors_url":"https://api.github.com/repos/nikhilj13/suit/contributors","subscribers_url":"https://api.github.com/repos/nikhilj13/suit/subscribers","subscription_url":"https://api.github.com/repos/nikhilj13/suit/subscription","commits_url":"https://api.github.com/repos/nikhilj13/suit/commits{/sha}","git_commits_url":"https://api.github.com/repos/nikhilj13/suit/git/commits{/sha}","comments_url":"https://api.github.com/repos/nikhilj13/suit/comments{/number}","issue_comment_url":"https://api.github.com/repos/nikhilj13/suit/issues/comments{/number}","contents_url":"https://api.github.com/repos/nikhilj13/suit/contents/{+path}","compare_url":"https://api.github.com/repos/nikhilj13/suit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nikhilj13/suit/merges","archive_url":"https://api.github.com/repos/nikhilj13/suit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nikhilj13/suit/downloads","issues_url":"https://api.github.com/repos/nikhilj13/suit/issues{/number}","pulls_url":"https://api.github.com/repos/nikhilj13/suit/pulls{/number}","milestones_url":"https://api.github.com/repos/nikhilj13/suit/milestones{/number}","notifications_url":"https://api.github.com/repos/nikhilj13/suit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nikhilj13/suit/labels{/name}","releases_url":"https://api.github.com/repos/nikhilj13/suit/releases{/id}","deployments_url":"https://api.github.com/repos/nikhilj13/suit/deployments","created_at":"2019-04-24T17:23:58Z","updated_at":"2019-04-24T17:24:01Z","pushed_at":"2019-07-15T18:59:35Z","git_url":"git://github.com/nikhilj13/suit.git","ssh_url":"git@github.com:nikhilj13/suit.git","clone_url":"https://github.com/nikhilj13/suit.git","svn_url":"https://github.com/nikhilj13/suit","homepage":"http://www.attivio.com","size":12131,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"attivio:master","ref":"master","sha":"64cd5e3ec6fb945c613c03a4bad6a038d11cc6e8","user":{"login":"attivio","id":10134282,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwMTM0Mjgy","avatar_url":"https://avatars2.githubusercontent.com/u/10134282?v=4","gravatar_id":"","url":"https://api.github.com/users/attivio","html_url":"https://github.com/attivio","followers_url":"https://api.github.com/users/attivio/followers","following_url":"https://api.github.com/users/attivio/following{/other_user}","gists_url":"https://api.github.com/users/attivio/gists{/gist_id}","starred_url":"https://api.github.com/users/attivio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/attivio/subscriptions","organizations_url":"https://api.github.com/users/attivio/orgs","repos_url":"https://api.github.com/users/attivio/repos","events_url":"https://api.github.com/users/attivio/events{/privacy}","received_events_url":"https://api.github.com/users/attivio/received_events","type":"Organization","site_admin":false},"repo":{"id":120645358,"node_id":"MDEwOlJlcG9zaXRvcnkxMjA2NDUzNTg=","name":"suit","full_name":"attivio/suit","private":false,"owner":{"login":"attivio","id":10134282,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwMTM0Mjgy","avatar_url":"https://avatars2.githubusercontent.com/u/10134282?v=4","gravatar_id":"","url":"https://api.github.com/users/attivio","html_url":"https://github.com/attivio","followers_url":"https://api.github.com/users/attivio/followers","following_url":"https://api.github.com/users/attivio/following{/other_user}","gists_url":"https://api.github.com/users/attivio/gists{/gist_id}","starred_url":"https://api.github.com/users/attivio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/attivio/subscriptions","organizations_url":"https://api.github.com/users/attivio/orgs","repos_url":"https://api.github.com/users/attivio/repos","events_url":"https://api.github.com/users/attivio/events{/privacy}","received_events_url":"https://api.github.com/users/attivio/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/attivio/suit","description":"Attivio Search UI Toolkit (SUIT) is a library for creating search clients for searching the Attivio platform.","fork":false,"url":"https://api.github.com/repos/attivio/suit","forks_url":"https://api.github.com/repos/attivio/suit/forks","keys_url":"https://api.github.com/repos/attivio/suit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/attivio/suit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/attivio/suit/teams","hooks_url":"https://api.github.com/repos/attivio/suit/hooks","issue_events_url":"https://api.github.com/repos/attivio/suit/issues/events{/number}","events_url":"https://api.github.com/repos/attivio/suit/events","assignees_url":"https://api.github.com/repos/attivio/suit/assignees{/user}","branches_url":"https://api.github.com/repos/attivio/suit/branches{/branch}","tags_url":"https://api.github.com/repos/attivio/suit/tags","blobs_url":"https://api.github.com/repos/attivio/suit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/attivio/suit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/attivio/suit/git/refs{/sha}","trees_url":"https://api.github.com/repos/attivio/suit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/attivio/suit/statuses/{sha}","languages_url":"https://api.github.com/repos/attivio/suit/languages","stargazers_url":"https://api.github.com/repos/attivio/suit/stargazers","contributors_url":"https://api.github.com/repos/attivio/suit/contributors","subscribers_url":"https://api.github.com/repos/attivio/suit/subscribers","subscription_url":"https://api.github.com/repos/attivio/suit/subscription","commits_url":"https://api.github.com/repos/attivio/suit/commits{/sha}","git_commits_url":"https://api.github.com/repos/attivio/suit/git/commits{/sha}","comments_url":"https://api.github.com/repos/attivio/suit/comments{/number}","issue_comment_url":"https://api.github.com/repos/attivio/suit/issues/comments{/number}","contents_url":"https://api.github.com/repos/attivio/suit/contents/{+path}","compare_url":"https://api.github.com/repos/attivio/suit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/attivio/suit/merges","archive_url":"https://api.github.com/repos/attivio/suit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/attivio/suit/downloads","issues_url":"https://api.github.com/repos/attivio/suit/issues{/number}","pulls_url":"https://api.github.com/repos/attivio/suit/pulls{/number}","milestones_url":"https://api.github.com/repos/attivio/suit/milestones{/number}","notifications_url":"https://api.github.com/repos/attivio/suit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/attivio/suit/labels{/name}","releases_url":"https://api.github.com/repos/attivio/suit/releases{/id}","deployments_url":"https://api.github.com/repos/attivio/suit/deployments","created_at":"2018-02-07T17:07:06Z","updated_at":"2019-07-12T17:48:53Z","pushed_at":"2019-07-15T19:53:43Z","git_url":"git://github.com/attivio/suit.git","ssh_url":"git@github.com:attivio/suit.git","clone_url":"https://github.com/attivio/suit.git","svn_url":"https://github.com/attivio/suit","homepage":"http://www.attivio.com","size":12056,"stargazers_count":8,"watchers_count":8,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":19,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":41,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":19,"open_issues":41,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/attivio/suit/pulls/138"},"html":{"href":"https://github.com/attivio/suit/pull/138"},"issue":{"href":"https://api.github.com/repos/attivio/suit/issues/138"},"comments":{"href":"https://api.github.com/repos/attivio/suit/issues/138/comments"},"review_comments":{"href":"https://api.github.com/repos/attivio/suit/pulls/138/comments"},"review_comment":{"href":"https://api.github.com/repos/attivio/suit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/attivio/suit/pulls/138/commits"},"statuses":{"href":"https://api.github.com/repos/attivio/suit/statuses/1438d5293313ff70171f64d266a7acae44351067"}},"author_association":"CONTRIBUTOR"}}
other: {"actor":{"display_login":"klk1010"}}