{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/ftms/pulls/comments/93824255","pull_request_review_id":14360016,"id":93824255,"diff_hunk":"@@ -27,17 +29,45 @@ def initialize args = {}\n     end\n   end\n \n+  def load_answers\n+    @load_answers ||= @post.comments.roots.order_by_votes\n+      .includes(:user).per_page_kaminari(@params[:page])\n+      .per Settings.faq.answers_per_page\n+  end\n+\n+  def load_replies answer\n+    answer.children.includes(:user).per_page_kaminari(@params[:page])\n+      .per Settings.faq.replies_per_page\n+  end\n+\n   def most_tagged_tags\n     @most_tagged_tags ||= Post.tag_counts_on(:tags).order(\"COUNT DESC\")\n       .limit Settings.faq.most_tagged_tags\n   end\n \n-  def votes\n-    @votes ||= @post.get_upvotes.size - @post.get_downvotes.size\n+  def related_posts\n+    @related_posts ||= @post.find_related_tags.order_by_votes\n+      .includes(:taggings).take Settings.faq.related_posts\n   end\n \n-  def related_posts\n-    @posts ||= @post.find_related_tags.take(Settings.faq.related_posts)\n-      .sort_by{|post| post.get_upvotes.size - post.get_downvotes.size}\n+  def parent_comment\n+    parent_id = if @params[:comment]\n+      @params[:comment][:parent_id]\n+    else\n+      @params[:parent_id]\n+    end\n+    @parent_comment ||= @post.comments.find_by id: parent_id\n+  end\n+\n+  def new_sub_comment\n+    @new_sub_comment ||= if parent_comment.root?\n+        parent_comment.children.build user: @user","path":"app/models/supports/post_support.rb","position":50,"original_position":50,"commit_id":"0fbfe5783de776f040a33851c7468328ebe25cc5","original_commit_id":"0fbfe5783de776f040a33851c7468328ebe25cc5","user":{"login":"hellovietnam93","id":8023606,"avatar_url":"https://avatars.githubusercontent.com/u/8023606?v=3","gravatar_id":"","url":"https://api.github.com/users/hellovietnam93","html_url":"https://github.com/hellovietnam93","followers_url":"https://api.github.com/users/hellovietnam93/followers","following_url":"https://api.github.com/users/hellovietnam93/following{/other_user}","gists_url":"https://api.github.com/users/hellovietnam93/gists{/gist_id}","starred_url":"https://api.github.com/users/hellovietnam93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellovietnam93/subscriptions","organizations_url":"https://api.github.com/users/hellovietnam93/orgs","repos_url":"https://api.github.com/users/hellovietnam93/repos","events_url":"https://api.github.com/users/hellovietnam93/events{/privacy}","received_events_url":"https://api.github.com/users/hellovietnam93/received_events","type":"User","site_admin":false},"body":"ident","created_at":"2016-12-25T05:36:10Z","updated_at":"2016-12-25T05:38:13Z","html_url":"https://github.com/framgia/ftms/pull/945#discussion_r93824255","pull_request_url":"https://api.github.com/repos/framgia/ftms/pulls/945","_links":{"self":{"href":"https://api.github.com/repos/framgia/ftms/pulls/comments/93824255"},"html":{"href":"https://github.com/framgia/ftms/pull/945#discussion_r93824255"},"pull_request":{"href":"https://api.github.com/repos/framgia/ftms/pulls/945"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/ftms/pulls/945","id":99297999,"html_url":"https://github.com/framgia/ftms/pull/945","diff_url":"https://github.com/framgia/ftms/pull/945.diff","patch_url":"https://github.com/framgia/ftms/pull/945.patch","issue_url":"https://api.github.com/repos/framgia/ftms/issues/945","number":945,"state":"open","locked":false,"title":"CRUD Q&A comments","user":{"login":"sangnuce","id":12852873,"avatar_url":"https://avatars.githubusercontent.com/u/12852873?v=3","gravatar_id":"","url":"https://api.github.com/users/sangnuce","html_url":"https://github.com/sangnuce","followers_url":"https://api.github.com/users/sangnuce/followers","following_url":"https://api.github.com/users/sangnuce/following{/other_user}","gists_url":"https://api.github.com/users/sangnuce/gists{/gist_id}","starred_url":"https://api.github.com/users/sangnuce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sangnuce/subscriptions","organizations_url":"https://api.github.com/users/sangnuce/orgs","repos_url":"https://api.github.com/users/sangnuce/repos","events_url":"https://api.github.com/users/sangnuce/events{/privacy}","received_events_url":"https://api.github.com/users/sangnuce/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-24T07:53:05Z","updated_at":"2016-12-25T05:38:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a0af0a57f4d732aa65464ee02bd50a2ccef7e813","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/ftms/pulls/945/commits","review_comments_url":"https://api.github.com/repos/framgia/ftms/pulls/945/comments","review_comment_url":"https://api.github.com/repos/framgia/ftms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/ftms/issues/945/comments","statuses_url":"https://api.github.com/repos/framgia/ftms/statuses/0fbfe5783de776f040a33851c7468328ebe25cc5","head":{"label":"sangnuce:CRUD-QnA-comments","ref":"CRUD-QnA-comments","sha":"0fbfe5783de776f040a33851c7468328ebe25cc5","user":{"login":"sangnuce","id":12852873,"avatar_url":"https://avatars.githubusercontent.com/u/12852873?v=3","gravatar_id":"","url":"https://api.github.com/users/sangnuce","html_url":"https://github.com/sangnuce","followers_url":"https://api.github.com/users/sangnuce/followers","following_url":"https://api.github.com/users/sangnuce/following{/other_user}","gists_url":"https://api.github.com/users/sangnuce/gists{/gist_id}","starred_url":"https://api.github.com/users/sangnuce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sangnuce/subscriptions","organizations_url":"https://api.github.com/users/sangnuce/orgs","repos_url":"https://api.github.com/users/sangnuce/repos","events_url":"https://api.github.com/users/sangnuce/events{/privacy}","received_events_url":"https://api.github.com/users/sangnuce/received_events","type":"User","site_admin":false},"repo":{"id":75577448,"name":"ftms","full_name":"sangnuce/ftms","owner":{"login":"sangnuce","id":12852873,"avatar_url":"https://avatars.githubusercontent.com/u/12852873?v=3","gravatar_id":"","url":"https://api.github.com/users/sangnuce","html_url":"https://github.com/sangnuce","followers_url":"https://api.github.com/users/sangnuce/followers","following_url":"https://api.github.com/users/sangnuce/following{/other_user}","gists_url":"https://api.github.com/users/sangnuce/gists{/gist_id}","starred_url":"https://api.github.com/users/sangnuce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sangnuce/subscriptions","organizations_url":"https://api.github.com/users/sangnuce/orgs","repos_url":"https://api.github.com/users/sangnuce/repos","events_url":"https://api.github.com/users/sangnuce/events{/privacy}","received_events_url":"https://api.github.com/users/sangnuce/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sangnuce/ftms","description":"Framgia Training Management System","fork":true,"url":"https://api.github.com/repos/sangnuce/ftms","forks_url":"https://api.github.com/repos/sangnuce/ftms/forks","keys_url":"https://api.github.com/repos/sangnuce/ftms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sangnuce/ftms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sangnuce/ftms/teams","hooks_url":"https://api.github.com/repos/sangnuce/ftms/hooks","issue_events_url":"https://api.github.com/repos/sangnuce/ftms/issues/events{/number}","events_url":"https://api.github.com/repos/sangnuce/ftms/events","assignees_url":"https://api.github.com/repos/sangnuce/ftms/assignees{/user}","branches_url":"https://api.github.com/repos/sangnuce/ftms/branches{/branch}","tags_url":"https://api.github.com/repos/sangnuce/ftms/tags","blobs_url":"https://api.github.com/repos/sangnuce/ftms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sangnuce/ftms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sangnuce/ftms/git/refs{/sha}","trees_url":"https://api.github.com/repos/sangnuce/ftms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sangnuce/ftms/statuses/{sha}","languages_url":"https://api.github.com/repos/sangnuce/ftms/languages","stargazers_url":"https://api.github.com/repos/sangnuce/ftms/stargazers","contributors_url":"https://api.github.com/repos/sangnuce/ftms/contributors","subscribers_url":"https://api.github.com/repos/sangnuce/ftms/subscribers","subscription_url":"https://api.github.com/repos/sangnuce/ftms/subscription","commits_url":"https://api.github.com/repos/sangnuce/ftms/commits{/sha}","git_commits_url":"https://api.github.com/repos/sangnuce/ftms/git/commits{/sha}","comments_url":"https://api.github.com/repos/sangnuce/ftms/comments{/number}","issue_comment_url":"https://api.github.com/repos/sangnuce/ftms/issues/comments{/number}","contents_url":"https://api.github.com/repos/sangnuce/ftms/contents/{+path}","compare_url":"https://api.github.com/repos/sangnuce/ftms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sangnuce/ftms/merges","archive_url":"https://api.github.com/repos/sangnuce/ftms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sangnuce/ftms/downloads","issues_url":"https://api.github.com/repos/sangnuce/ftms/issues{/number}","pulls_url":"https://api.github.com/repos/sangnuce/ftms/pulls{/number}","milestones_url":"https://api.github.com/repos/sangnuce/ftms/milestones{/number}","notifications_url":"https://api.github.com/repos/sangnuce/ftms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sangnuce/ftms/labels{/name}","releases_url":"https://api.github.com/repos/sangnuce/ftms/releases{/id}","deployments_url":"https://api.github.com/repos/sangnuce/ftms/deployments","created_at":"2016-12-05T01:33:34Z","updated_at":"2015-09-10T03:49:19Z","pushed_at":"2016-12-25T05:28:05Z","git_url":"git://github.com/sangnuce/ftms.git","ssh_url":"git@github.com:sangnuce/ftms.git","clone_url":"https://github.com/sangnuce/ftms.git","svn_url":"https://github.com/sangnuce/ftms","homepage":null,"size":7655,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"framgia:1.2.1","ref":"1.2.1","sha":"5a6379504c5d16fa52055c3f8cc5fb6185332563","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":42220671,"name":"ftms","full_name":"framgia/ftms","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/ftms","description":"Framgia Training Management System","fork":false,"url":"https://api.github.com/repos/framgia/ftms","forks_url":"https://api.github.com/repos/framgia/ftms/forks","keys_url":"https://api.github.com/repos/framgia/ftms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/ftms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/ftms/teams","hooks_url":"https://api.github.com/repos/framgia/ftms/hooks","issue_events_url":"https://api.github.com/repos/framgia/ftms/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/ftms/events","assignees_url":"https://api.github.com/repos/framgia/ftms/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/ftms/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/ftms/tags","blobs_url":"https://api.github.com/repos/framgia/ftms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/ftms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/ftms/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/ftms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/ftms/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/ftms/languages","stargazers_url":"https://api.github.com/repos/framgia/ftms/stargazers","contributors_url":"https://api.github.com/repos/framgia/ftms/contributors","subscribers_url":"https://api.github.com/repos/framgia/ftms/subscribers","subscription_url":"https://api.github.com/repos/framgia/ftms/subscription","commits_url":"https://api.github.com/repos/framgia/ftms/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/ftms/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/ftms/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/ftms/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/ftms/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/ftms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/ftms/merges","archive_url":"https://api.github.com/repos/framgia/ftms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/ftms/downloads","issues_url":"https://api.github.com/repos/framgia/ftms/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/ftms/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/ftms/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/ftms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/ftms/labels{/name}","releases_url":"https://api.github.com/repos/framgia/ftms/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/ftms/deployments","created_at":"2015-09-10T03:49:19Z","updated_at":"2016-12-23T07:11:46Z","pushed_at":"2016-12-25T05:28:07Z","git_url":"git://github.com/framgia/ftms.git","ssh_url":"git@github.com:framgia/ftms.git","clone_url":"https://github.com/framgia/ftms.git","svn_url":"https://github.com/framgia/ftms","homepage":null,"size":7642,"stargazers_count":2,"watchers_count":2,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":6,"forks":40,"open_issues":6,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/ftms/pulls/945"},"html":{"href":"https://github.com/framgia/ftms/pull/945"},"issue":{"href":"https://api.github.com/repos/framgia/ftms/issues/945"},"comments":{"href":"https://api.github.com/repos/framgia/ftms/issues/945/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/ftms/pulls/945/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/ftms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/ftms/pulls/945/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/ftms/statuses/0fbfe5783de776f040a33851c7468328ebe25cc5"}}}}
{"actor":{"display_login":"hellovietnam93"}}