{"action":"created","comment":{"url":"https://api.github.com/repos/nusmodifications/nusmods/pulls/comments/175644509","pull_request_review_id":105206570,"id":175644509,"diff_hunk":"@@ -0,0 +1,55 @@\n+// @flow\n+import type { DisqusConfig } from 'types/views';\n+\n+import React, { PureComponent } from 'react';\n+import config from 'config';\n+import insertScript from 'utils/insertScript';\n+import { MessageSquare } from 'views/components/icons';\n+import styles from './CommentCount.scss';\n+\n+type Props = DisqusConfig & {\n+  commentIcon: Node,\n+};\n+\n+const SCRIPT_ID = 'dsq-count-scr';\n+\n+export default class CommentCount extends PureComponent<Props> {\n+  static defaultProps = {\n+    commentIcon: <MessageSquare aria-label=\"Comment count\" />,\n+  };\n+\n+  static loadInstance() {\n+    if (window.document.getElementById('dsq-count-scr')) {\n+      if (window.DISQUSWIDGETS) {\n+        window.DISQUSWIDGETS.getCount({\n+          reset: true,\n+        });\n+      }\n+    } else {\n+      insertScript(`https://${config.disqusShortname}.disqus.com/count.js`, SCRIPT_ID, true);\n+    }\n+  }\n+\n+  componentDidMount() {\n+    CommentCount.loadInstance();\n+  }\n+\n+  componentDidUpdate() {\n+    CommentCount.loadInstance();\n+  }\n+\n+  render() {\n+    const { identifier, url, commentIcon } = this.props;\n+\n+    return (\n+      <span className={styles.comment}>\n+        <span className={styles.icon}> {commentIcon} </span>","path":"www/src/js/views/components/disqus/CommentCount.jsx","position":46,"original_position":46,"commit_id":"9719857255568f166f1c51d5acaac109bdb5d5da","original_commit_id":"48d8c0b35d69117b8c9023e07c97223bb8b3981a","user":{"login":"ZhangYiJiang","id":445650,"avatar_url":"https://avatars0.githubusercontent.com/u/445650?v=4","gravatar_id":"","url":"https://api.github.com/users/ZhangYiJiang","html_url":"https://github.com/ZhangYiJiang","followers_url":"https://api.github.com/users/ZhangYiJiang/followers","following_url":"https://api.github.com/users/ZhangYiJiang/following{/other_user}","gists_url":"https://api.github.com/users/ZhangYiJiang/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhangYiJiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhangYiJiang/subscriptions","organizations_url":"https://api.github.com/users/ZhangYiJiang/orgs","repos_url":"https://api.github.com/users/ZhangYiJiang/repos","events_url":"https://api.github.com/users/ZhangYiJiang/events{/privacy}","received_events_url":"https://api.github.com/users/ZhangYiJiang/received_events","type":"User","site_admin":false},"body":"I think this is fine because that's where a space would naturally appear. ","created_at":"2018-03-20T03:06:56Z","updated_at":"2018-03-20T03:06:56Z","html_url":"https://github.com/nusmodifications/nusmods/pull/950#discussion_r175644509","pull_request_url":"https://api.github.com/repos/nusmodifications/nusmods/pulls/950","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/nusmodifications/nusmods/pulls/comments/175644509"},"html":{"href":"https://github.com/nusmodifications/nusmods/pull/950#discussion_r175644509"},"pull_request":{"href":"https://api.github.com/repos/nusmodifications/nusmods/pulls/950"}},"in_reply_to_id":175632585},"pull_request":{"url":"https://api.github.com/repos/nusmodifications/nusmods/pulls/950","id":175929707,"html_url":"https://github.com/nusmodifications/nusmods/pull/950","diff_url":"https://github.com/nusmodifications/nusmods/pull/950.diff","patch_url":"https://github.com/nusmodifications/nusmods/pull/950.patch","issue_url":"https://api.github.com/repos/nusmodifications/nusmods/issues/950","number":950,"state":"open","locked":false,"title":"Show number of Disqus comments in module info page side menu #683","user":{"login":"wenmogu","id":28526038,"avatar_url":"https://avatars0.githubusercontent.com/u/28526038?v=4","gravatar_id":"","url":"https://api.github.com/users/wenmogu","html_url":"https://github.com/wenmogu","followers_url":"https://api.github.com/users/wenmogu/followers","following_url":"https://api.github.com/users/wenmogu/following{/other_user}","gists_url":"https://api.github.com/users/wenmogu/gists{/gist_id}","starred_url":"https://api.github.com/users/wenmogu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenmogu/subscriptions","organizations_url":"https://api.github.com/users/wenmogu/orgs","repos_url":"https://api.github.com/users/wenmogu/repos","events_url":"https://api.github.com/users/wenmogu/events{/privacy}","received_events_url":"https://api.github.com/users/wenmogu/received_events","type":"User","site_admin":false},"body":"Fixes #683 \r\n\r\n**Outline of solution**\r\n- copied here and there from the [example given](https://github.com/disqus/disqus-react/blob/master/src/CommentCount.jsx) and the `DisqusComments.jsx`\r\n- added style file for that count comments icon at side medu\r\n- written test for an extracted function used both in the `CommentCount.jsx` and `DisqusComments.jsx` (not sure if it is necessary)\r\n- retained the `map` function which produces the side-menu at `ModulePageContents.jsx` by adding a if-else condition to add the count comments icon\r\nAnd now it looks like this:\r\n![image](https://user-images.githubusercontent.com/28526038/37603621-f8151738-2bc9-11e8-891b-f524cff8e9b0.png)\r\n\r\n**Area in which i need help**\r\n- currently there is a visible lag in getting the number of review comments at the side menu (i.e. get the number on page load). I need help on how to eliminate that lag ><","created_at":"2018-03-19T15:09:13Z","updated_at":"2018-03-20T03:06:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"685f3efda61ec8336fdc4f05d66b35c2ce5858d6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/nusmodifications/nusmods/pulls/950/commits","review_comments_url":"https://api.github.com/repos/nusmodifications/nusmods/pulls/950/comments","review_comment_url":"https://api.github.com/repos/nusmodifications/nusmods/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nusmodifications/nusmods/issues/950/comments","statuses_url":"https://api.github.com/repos/nusmodifications/nusmods/statuses/9719857255568f166f1c51d5acaac109bdb5d5da","head":{"label":"wenmogu:tinker","ref":"tinker","sha":"9719857255568f166f1c51d5acaac109bdb5d5da","user":{"login":"wenmogu","id":28526038,"avatar_url":"https://avatars0.githubusercontent.com/u/28526038?v=4","gravatar_id":"","url":"https://api.github.com/users/wenmogu","html_url":"https://github.com/wenmogu","followers_url":"https://api.github.com/users/wenmogu/followers","following_url":"https://api.github.com/users/wenmogu/following{/other_user}","gists_url":"https://api.github.com/users/wenmogu/gists{/gist_id}","starred_url":"https://api.github.com/users/wenmogu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenmogu/subscriptions","organizations_url":"https://api.github.com/users/wenmogu/orgs","repos_url":"https://api.github.com/users/wenmogu/repos","events_url":"https://api.github.com/users/wenmogu/events{/privacy}","received_events_url":"https://api.github.com/users/wenmogu/received_events","type":"User","site_admin":false},"repo":{"id":125875152,"name":"nusmods","full_name":"wenmogu/nusmods","owner":{"login":"wenmogu","id":28526038,"avatar_url":"https://avatars0.githubusercontent.com/u/28526038?v=4","gravatar_id":"","url":"https://api.github.com/users/wenmogu","html_url":"https://github.com/wenmogu","followers_url":"https://api.github.com/users/wenmogu/followers","following_url":"https://api.github.com/users/wenmogu/following{/other_user}","gists_url":"https://api.github.com/users/wenmogu/gists{/gist_id}","starred_url":"https://api.github.com/users/wenmogu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenmogu/subscriptions","organizations_url":"https://api.github.com/users/wenmogu/orgs","repos_url":"https://api.github.com/users/wenmogu/repos","events_url":"https://api.github.com/users/wenmogu/events{/privacy}","received_events_url":"https://api.github.com/users/wenmogu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wenmogu/nusmods","description":"🏫 Unofficial course planning platform for National University of Singapore.","fork":true,"url":"https://api.github.com/repos/wenmogu/nusmods","forks_url":"https://api.github.com/repos/wenmogu/nusmods/forks","keys_url":"https://api.github.com/repos/wenmogu/nusmods/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wenmogu/nusmods/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wenmogu/nusmods/teams","hooks_url":"https://api.github.com/repos/wenmogu/nusmods/hooks","issue_events_url":"https://api.github.com/repos/wenmogu/nusmods/issues/events{/number}","events_url":"https://api.github.com/repos/wenmogu/nusmods/events","assignees_url":"https://api.github.com/repos/wenmogu/nusmods/assignees{/user}","branches_url":"https://api.github.com/repos/wenmogu/nusmods/branches{/branch}","tags_url":"https://api.github.com/repos/wenmogu/nusmods/tags","blobs_url":"https://api.github.com/repos/wenmogu/nusmods/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wenmogu/nusmods/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wenmogu/nusmods/git/refs{/sha}","trees_url":"https://api.github.com/repos/wenmogu/nusmods/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wenmogu/nusmods/statuses/{sha}","languages_url":"https://api.github.com/repos/wenmogu/nusmods/languages","stargazers_url":"https://api.github.com/repos/wenmogu/nusmods/stargazers","contributors_url":"https://api.github.com/repos/wenmogu/nusmods/contributors","subscribers_url":"https://api.github.com/repos/wenmogu/nusmods/subscribers","subscription_url":"https://api.github.com/repos/wenmogu/nusmods/subscription","commits_url":"https://api.github.com/repos/wenmogu/nusmods/commits{/sha}","git_commits_url":"https://api.github.com/repos/wenmogu/nusmods/git/commits{/sha}","comments_url":"https://api.github.com/repos/wenmogu/nusmods/comments{/number}","issue_comment_url":"https://api.github.com/repos/wenmogu/nusmods/issues/comments{/number}","contents_url":"https://api.github.com/repos/wenmogu/nusmods/contents/{+path}","compare_url":"https://api.github.com/repos/wenmogu/nusmods/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wenmogu/nusmods/merges","archive_url":"https://api.github.com/repos/wenmogu/nusmods/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wenmogu/nusmods/downloads","issues_url":"https://api.github.com/repos/wenmogu/nusmods/issues{/number}","pulls_url":"https://api.github.com/repos/wenmogu/nusmods/pulls{/number}","milestones_url":"https://api.github.com/repos/wenmogu/nusmods/milestones{/number}","notifications_url":"https://api.github.com/repos/wenmogu/nusmods/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wenmogu/nusmods/labels{/name}","releases_url":"https://api.github.com/repos/wenmogu/nusmods/releases{/id}","deployments_url":"https://api.github.com/repos/wenmogu/nusmods/deployments","created_at":"2018-03-19T14:57:01Z","updated_at":"2018-03-19T14:57:04Z","pushed_at":"2018-03-20T02:59:43Z","git_url":"git://github.com/wenmogu/nusmods.git","ssh_url":"git@github.com:wenmogu/nusmods.git","clone_url":"https://github.com/wenmogu/nusmods.git","svn_url":"https://github.com/wenmogu/nusmods","homepage":"https://nusmods.com","size":9995,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nusmodifications:master","ref":"master","sha":"cc32190282d7ae95ca6f196348b7ace7cddcc757","user":{"login":"nusmodifications","id":7428865,"avatar_url":"https://avatars3.githubusercontent.com/u/7428865?v=4","gravatar_id":"","url":"https://api.github.com/users/nusmodifications","html_url":"https://github.com/nusmodifications","followers_url":"https://api.github.com/users/nusmodifications/followers","following_url":"https://api.github.com/users/nusmodifications/following{/other_user}","gists_url":"https://api.github.com/users/nusmodifications/gists{/gist_id}","starred_url":"https://api.github.com/users/nusmodifications/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nusmodifications/subscriptions","organizations_url":"https://api.github.com/users/nusmodifications/orgs","repos_url":"https://api.github.com/users/nusmodifications/repos","events_url":"https://api.github.com/users/nusmodifications/events{/privacy}","received_events_url":"https://api.github.com/users/nusmodifications/received_events","type":"Organization","site_admin":false},"repo":{"id":5481861,"name":"nusmods","full_name":"nusmodifications/nusmods","owner":{"login":"nusmodifications","id":7428865,"avatar_url":"https://avatars3.githubusercontent.com/u/7428865?v=4","gravatar_id":"","url":"https://api.github.com/users/nusmodifications","html_url":"https://github.com/nusmodifications","followers_url":"https://api.github.com/users/nusmodifications/followers","following_url":"https://api.github.com/users/nusmodifications/following{/other_user}","gists_url":"https://api.github.com/users/nusmodifications/gists{/gist_id}","starred_url":"https://api.github.com/users/nusmodifications/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nusmodifications/subscriptions","organizations_url":"https://api.github.com/users/nusmodifications/orgs","repos_url":"https://api.github.com/users/nusmodifications/repos","events_url":"https://api.github.com/users/nusmodifications/events{/privacy}","received_events_url":"https://api.github.com/users/nusmodifications/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nusmodifications/nusmods","description":"🏫 Unofficial course planning platform for National University of Singapore.","fork":false,"url":"https://api.github.com/repos/nusmodifications/nusmods","forks_url":"https://api.github.com/repos/nusmodifications/nusmods/forks","keys_url":"https://api.github.com/repos/nusmodifications/nusmods/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nusmodifications/nusmods/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nusmodifications/nusmods/teams","hooks_url":"https://api.github.com/repos/nusmodifications/nusmods/hooks","issue_events_url":"https://api.github.com/repos/nusmodifications/nusmods/issues/events{/number}","events_url":"https://api.github.com/repos/nusmodifications/nusmods/events","assignees_url":"https://api.github.com/repos/nusmodifications/nusmods/assignees{/user}","branches_url":"https://api.github.com/repos/nusmodifications/nusmods/branches{/branch}","tags_url":"https://api.github.com/repos/nusmodifications/nusmods/tags","blobs_url":"https://api.github.com/repos/nusmodifications/nusmods/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nusmodifications/nusmods/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nusmodifications/nusmods/git/refs{/sha}","trees_url":"https://api.github.com/repos/nusmodifications/nusmods/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nusmodifications/nusmods/statuses/{sha}","languages_url":"https://api.github.com/repos/nusmodifications/nusmods/languages","stargazers_url":"https://api.github.com/repos/nusmodifications/nusmods/stargazers","contributors_url":"https://api.github.com/repos/nusmodifications/nusmods/contributors","subscribers_url":"https://api.github.com/repos/nusmodifications/nusmods/subscribers","subscription_url":"https://api.github.com/repos/nusmodifications/nusmods/subscription","commits_url":"https://api.github.com/repos/nusmodifications/nusmods/commits{/sha}","git_commits_url":"https://api.github.com/repos/nusmodifications/nusmods/git/commits{/sha}","comments_url":"https://api.github.com/repos/nusmodifications/nusmods/comments{/number}","issue_comment_url":"https://api.github.com/repos/nusmodifications/nusmods/issues/comments{/number}","contents_url":"https://api.github.com/repos/nusmodifications/nusmods/contents/{+path}","compare_url":"https://api.github.com/repos/nusmodifications/nusmods/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nusmodifications/nusmods/merges","archive_url":"https://api.github.com/repos/nusmodifications/nusmods/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nusmodifications/nusmods/downloads","issues_url":"https://api.github.com/repos/nusmodifications/nusmods/issues{/number}","pulls_url":"https://api.github.com/repos/nusmodifications/nusmods/pulls{/number}","milestones_url":"https://api.github.com/repos/nusmodifications/nusmods/milestones{/number}","notifications_url":"https://api.github.com/repos/nusmodifications/nusmods/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nusmodifications/nusmods/labels{/name}","releases_url":"https://api.github.com/repos/nusmodifications/nusmods/releases{/id}","deployments_url":"https://api.github.com/repos/nusmodifications/nusmods/deployments","created_at":"2012-08-20T13:58:35Z","updated_at":"2018-03-19T08:42:42Z","pushed_at":"2018-03-20T02:59:45Z","git_url":"git://github.com/nusmodifications/nusmods.git","ssh_url":"git@github.com:nusmodifications/nusmods.git","clone_url":"https://github.com/nusmodifications/nusmods.git","svn_url":"https://github.com/nusmodifications/nusmods","homepage":"https://nusmods.com","size":10075,"stargazers_count":183,"watchers_count":183,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":96,"mirror_url":null,"archived":false,"open_issues_count":70,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":96,"open_issues":70,"watchers":183,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nusmodifications/nusmods/pulls/950"},"html":{"href":"https://github.com/nusmodifications/nusmods/pull/950"},"issue":{"href":"https://api.github.com/repos/nusmodifications/nusmods/issues/950"},"comments":{"href":"https://api.github.com/repos/nusmodifications/nusmods/issues/950/comments"},"review_comments":{"href":"https://api.github.com/repos/nusmodifications/nusmods/pulls/950/comments"},"review_comment":{"href":"https://api.github.com/repos/nusmodifications/nusmods/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nusmodifications/nusmods/pulls/950/commits"},"statuses":{"href":"https://api.github.com/repos/nusmodifications/nusmods/statuses/9719857255568f166f1c51d5acaac109bdb5d5da"}},"author_association":"NONE"}}
{"actor":{"display_login":"ZhangYiJiang"}}