{"action":"created","comment":{"url":"https://api.github.com/repos/lionleaf/dwitter/pulls/comments/64022865","id":64022865,"diff_hunk":"@@ -26,7 +25,82 @@ var processLike = function()  {\n    $.ajax(config);\n };\n \n+var getCommentHTML = function(comment) {\n+       return '<div class=comment><p><b>'+comment.author+':</b>'+comment.text+'</p></div>';\n+}\n+var loadComments = function() {\n+  var step = 1000;\n+  var current_offset = $(this).data('offset') ;\n+\n+  var $load_comments_button = $(this);\n+\n+   var dweet_id = $load_comments_button.data('dweet_id');\n+   var next = $load_comments_button.data('next');\n+\n+   var loadCommentsResponse = function(serverResponse_json, textStatus_ignored,\n+       jqXHR_ignored)  {\n+\n+     var $comment_section = $load_comments_button.parents('.comments');\n+\n+     if(serverResponse_json.next){\n+       alert(\"Woops, there are more comments, but they are unloadable as of now. Please bug lionleaf to fix\");\n+     }else{\n+       $load_comments_button.parents('.comment').hide();\n+     }\n+     var new_comment_list = '';\n+     for(var i in serverResponse_json.results.reverse()){\n+       var comment = serverResponse_json.results[i];\n+       console.log(comment);\n+       console.log($comment_section);\n+       new_comment_list  += getCommentHTML(comment);\n+     }\n+     $comment_section[0].innerHTML = new_comment_list + $comment_section[0].innerHTML;\n+     \n+   }\n+\n+   var config = {\n+     url: 'api/comments/?offset='+current_offset+'&limit='+step+'&format=json&reply_to='+dweet_id,\n+     dataType: 'json',\n+      success: loadCommentsResponse,\n+   };\n+   $.ajax(config);\n+}\n+\n+var postComment = function() {\n+  var $post_comment_button = $(this);\n+  var dweet_id = $post_comment_button.data('dweet_id');\n+  var csrf = $post_comment_button.data('csrf');\n+  console.log(\"csrf: \" + csrf);\n+  var $comment_text = $post_comment_button.siblings('.comment-input');\n+  var $comment_section = $post_comment_button.closest('.comment-section').children('.comments');\n+\n+  var postCommentResponse = function(serverResponse_json, textStatus_ignored,\n+      jqXHR_ignored)  {\n+\n+    $comment_text[0].value = '';\n+    $comment_section[0].innerHTML =  $comment_section[0].innerHTML + getCommentHTML(serverResponse_json);\n+  }\n+\n+  var comment = {\n+    reply_to: dweet_id,\n+    text: $comment_text[0].value,\n+    csrfmiddlewaretoken: csrf,\n+  }\n+\n+  var config = {\n+    url: 'api/comments/',","path":"dwitter/static/js/ajax-handling.js","position":79,"original_position":79,"commit_id":"d456cf59993a2671a987a9895045b29bf0c33468","original_commit_id":"d456cf59993a2671a987a9895045b29bf0c33468","user":{"login":"stianjensen","id":1413267,"avatar_url":"https://avatars.githubusercontent.com/u/1413267?v=3","gravatar_id":"","url":"https://api.github.com/users/stianjensen","html_url":"https://github.com/stianjensen","followers_url":"https://api.github.com/users/stianjensen/followers","following_url":"https://api.github.com/users/stianjensen/following{/other_user}","gists_url":"https://api.github.com/users/stianjensen/gists{/gist_id}","starred_url":"https://api.github.com/users/stianjensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stianjensen/subscriptions","organizations_url":"https://api.github.com/users/stianjensen/orgs","repos_url":"https://api.github.com/users/stianjensen/repos","events_url":"https://api.github.com/users/stianjensen/events{/privacy}","received_events_url":"https://api.github.com/users/stianjensen/received_events","type":"User","site_admin":false},"body":"Consider making this URL absolute","created_at":"2016-05-20T10:51:07Z","updated_at":"2016-05-20T10:51:08Z","html_url":"https://github.com/lionleaf/dwitter/pull/32#discussion_r64022865","pull_request_url":"https://api.github.com/repos/lionleaf/dwitter/pulls/32","_links":{"self":{"href":"https://api.github.com/repos/lionleaf/dwitter/pulls/comments/64022865"},"html":{"href":"https://github.com/lionleaf/dwitter/pull/32#discussion_r64022865"},"pull_request":{"href":"https://api.github.com/repos/lionleaf/dwitter/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/lionleaf/dwitter/pulls/32","id":70798990,"html_url":"https://github.com/lionleaf/dwitter/pull/32","diff_url":"https://github.com/lionleaf/dwitter/pull/32.diff","patch_url":"https://github.com/lionleaf/dwitter/pull/32.patch","issue_url":"https://api.github.com/repos/lionleaf/dwitter/issues/32","number":32,"state":"open","locked":false,"title":"Implement comments to dweets","user":{"login":"lionleaf","id":610925,"avatar_url":"https://avatars.githubusercontent.com/u/610925?v=3","gravatar_id":"","url":"https://api.github.com/users/lionleaf","html_url":"https://github.com/lionleaf","followers_url":"https://api.github.com/users/lionleaf/followers","following_url":"https://api.github.com/users/lionleaf/following{/other_user}","gists_url":"https://api.github.com/users/lionleaf/gists{/gist_id}","starred_url":"https://api.github.com/users/lionleaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionleaf/subscriptions","organizations_url":"https://api.github.com/users/lionleaf/orgs","repos_url":"https://api.github.com/users/lionleaf/repos","events_url":"https://api.github.com/users/lionleaf/events{/privacy}","received_events_url":"https://api.github.com/users/lionleaf/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-20T04:08:10Z","updated_at":"2016-05-20T10:51:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07278f96f5bde543f5357e600227b8d76e2aa3f3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lionleaf/dwitter/pulls/32/commits","review_comments_url":"https://api.github.com/repos/lionleaf/dwitter/pulls/32/comments","review_comment_url":"https://api.github.com/repos/lionleaf/dwitter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lionleaf/dwitter/issues/32/comments","statuses_url":"https://api.github.com/repos/lionleaf/dwitter/statuses/d456cf59993a2671a987a9895045b29bf0c33468","head":{"label":"lionleaf:rest-comments","ref":"rest-comments","sha":"d456cf59993a2671a987a9895045b29bf0c33468","user":{"login":"lionleaf","id":610925,"avatar_url":"https://avatars.githubusercontent.com/u/610925?v=3","gravatar_id":"","url":"https://api.github.com/users/lionleaf","html_url":"https://github.com/lionleaf","followers_url":"https://api.github.com/users/lionleaf/followers","following_url":"https://api.github.com/users/lionleaf/following{/other_user}","gists_url":"https://api.github.com/users/lionleaf/gists{/gist_id}","starred_url":"https://api.github.com/users/lionleaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionleaf/subscriptions","organizations_url":"https://api.github.com/users/lionleaf/orgs","repos_url":"https://api.github.com/users/lionleaf/repos","events_url":"https://api.github.com/users/lionleaf/events{/privacy}","received_events_url":"https://api.github.com/users/lionleaf/received_events","type":"User","site_admin":false},"repo":{"id":48773071,"name":"dwitter","full_name":"lionleaf/dwitter","owner":{"login":"lionleaf","id":610925,"avatar_url":"https://avatars.githubusercontent.com/u/610925?v=3","gravatar_id":"","url":"https://api.github.com/users/lionleaf","html_url":"https://github.com/lionleaf","followers_url":"https://api.github.com/users/lionleaf/followers","following_url":"https://api.github.com/users/lionleaf/following{/other_user}","gists_url":"https://api.github.com/users/lionleaf/gists{/gist_id}","starred_url":"https://api.github.com/users/lionleaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionleaf/subscriptions","organizations_url":"https://api.github.com/users/lionleaf/orgs","repos_url":"https://api.github.com/users/lionleaf/repos","events_url":"https://api.github.com/users/lionleaf/events{/privacy}","received_events_url":"https://api.github.com/users/lionleaf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lionleaf/dwitter","description":"Social network for short js demos","fork":false,"url":"https://api.github.com/repos/lionleaf/dwitter","forks_url":"https://api.github.com/repos/lionleaf/dwitter/forks","keys_url":"https://api.github.com/repos/lionleaf/dwitter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lionleaf/dwitter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lionleaf/dwitter/teams","hooks_url":"https://api.github.com/repos/lionleaf/dwitter/hooks","issue_events_url":"https://api.github.com/repos/lionleaf/dwitter/issues/events{/number}","events_url":"https://api.github.com/repos/lionleaf/dwitter/events","assignees_url":"https://api.github.com/repos/lionleaf/dwitter/assignees{/user}","branches_url":"https://api.github.com/repos/lionleaf/dwitter/branches{/branch}","tags_url":"https://api.github.com/repos/lionleaf/dwitter/tags","blobs_url":"https://api.github.com/repos/lionleaf/dwitter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lionleaf/dwitter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lionleaf/dwitter/git/refs{/sha}","trees_url":"https://api.github.com/repos/lionleaf/dwitter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lionleaf/dwitter/statuses/{sha}","languages_url":"https://api.github.com/repos/lionleaf/dwitter/languages","stargazers_url":"https://api.github.com/repos/lionleaf/dwitter/stargazers","contributors_url":"https://api.github.com/repos/lionleaf/dwitter/contributors","subscribers_url":"https://api.github.com/repos/lionleaf/dwitter/subscribers","subscription_url":"https://api.github.com/repos/lionleaf/dwitter/subscription","commits_url":"https://api.github.com/repos/lionleaf/dwitter/commits{/sha}","git_commits_url":"https://api.github.com/repos/lionleaf/dwitter/git/commits{/sha}","comments_url":"https://api.github.com/repos/lionleaf/dwitter/comments{/number}","issue_comment_url":"https://api.github.com/repos/lionleaf/dwitter/issues/comments{/number}","contents_url":"https://api.github.com/repos/lionleaf/dwitter/contents/{+path}","compare_url":"https://api.github.com/repos/lionleaf/dwitter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lionleaf/dwitter/merges","archive_url":"https://api.github.com/repos/lionleaf/dwitter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lionleaf/dwitter/downloads","issues_url":"https://api.github.com/repos/lionleaf/dwitter/issues{/number}","pulls_url":"https://api.github.com/repos/lionleaf/dwitter/pulls{/number}","milestones_url":"https://api.github.com/repos/lionleaf/dwitter/milestones{/number}","notifications_url":"https://api.github.com/repos/lionleaf/dwitter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lionleaf/dwitter/labels{/name}","releases_url":"https://api.github.com/repos/lionleaf/dwitter/releases{/id}","deployments_url":"https://api.github.com/repos/lionleaf/dwitter/deployments","created_at":"2015-12-30T00:24:39Z","updated_at":"2016-04-20T23:48:54Z","pushed_at":"2016-05-20T05:30:02Z","git_url":"git://github.com/lionleaf/dwitter.git","ssh_url":"git@github.com:lionleaf/dwitter.git","clone_url":"https://github.com/lionleaf/dwitter.git","svn_url":"https://github.com/lionleaf/dwitter","homepage":"","size":157,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":12,"forks":3,"open_issues":12,"watchers":3,"default_branch":"dev"}},"base":{"label":"lionleaf:dev","ref":"dev","sha":"6bb98c99f168175f3721c86f779754ccb8875853","user":{"login":"lionleaf","id":610925,"avatar_url":"https://avatars.githubusercontent.com/u/610925?v=3","gravatar_id":"","url":"https://api.github.com/users/lionleaf","html_url":"https://github.com/lionleaf","followers_url":"https://api.github.com/users/lionleaf/followers","following_url":"https://api.github.com/users/lionleaf/following{/other_user}","gists_url":"https://api.github.com/users/lionleaf/gists{/gist_id}","starred_url":"https://api.github.com/users/lionleaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionleaf/subscriptions","organizations_url":"https://api.github.com/users/lionleaf/orgs","repos_url":"https://api.github.com/users/lionleaf/repos","events_url":"https://api.github.com/users/lionleaf/events{/privacy}","received_events_url":"https://api.github.com/users/lionleaf/received_events","type":"User","site_admin":false},"repo":{"id":48773071,"name":"dwitter","full_name":"lionleaf/dwitter","owner":{"login":"lionleaf","id":610925,"avatar_url":"https://avatars.githubusercontent.com/u/610925?v=3","gravatar_id":"","url":"https://api.github.com/users/lionleaf","html_url":"https://github.com/lionleaf","followers_url":"https://api.github.com/users/lionleaf/followers","following_url":"https://api.github.com/users/lionleaf/following{/other_user}","gists_url":"https://api.github.com/users/lionleaf/gists{/gist_id}","starred_url":"https://api.github.com/users/lionleaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lionleaf/subscriptions","organizations_url":"https://api.github.com/users/lionleaf/orgs","repos_url":"https://api.github.com/users/lionleaf/repos","events_url":"https://api.github.com/users/lionleaf/events{/privacy}","received_events_url":"https://api.github.com/users/lionleaf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lionleaf/dwitter","description":"Social network for short js demos","fork":false,"url":"https://api.github.com/repos/lionleaf/dwitter","forks_url":"https://api.github.com/repos/lionleaf/dwitter/forks","keys_url":"https://api.github.com/repos/lionleaf/dwitter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lionleaf/dwitter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lionleaf/dwitter/teams","hooks_url":"https://api.github.com/repos/lionleaf/dwitter/hooks","issue_events_url":"https://api.github.com/repos/lionleaf/dwitter/issues/events{/number}","events_url":"https://api.github.com/repos/lionleaf/dwitter/events","assignees_url":"https://api.github.com/repos/lionleaf/dwitter/assignees{/user}","branches_url":"https://api.github.com/repos/lionleaf/dwitter/branches{/branch}","tags_url":"https://api.github.com/repos/lionleaf/dwitter/tags","blobs_url":"https://api.github.com/repos/lionleaf/dwitter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lionleaf/dwitter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lionleaf/dwitter/git/refs{/sha}","trees_url":"https://api.github.com/repos/lionleaf/dwitter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lionleaf/dwitter/statuses/{sha}","languages_url":"https://api.github.com/repos/lionleaf/dwitter/languages","stargazers_url":"https://api.github.com/repos/lionleaf/dwitter/stargazers","contributors_url":"https://api.github.com/repos/lionleaf/dwitter/contributors","subscribers_url":"https://api.github.com/repos/lionleaf/dwitter/subscribers","subscription_url":"https://api.github.com/repos/lionleaf/dwitter/subscription","commits_url":"https://api.github.com/repos/lionleaf/dwitter/commits{/sha}","git_commits_url":"https://api.github.com/repos/lionleaf/dwitter/git/commits{/sha}","comments_url":"https://api.github.com/repos/lionleaf/dwitter/comments{/number}","issue_comment_url":"https://api.github.com/repos/lionleaf/dwitter/issues/comments{/number}","contents_url":"https://api.github.com/repos/lionleaf/dwitter/contents/{+path}","compare_url":"https://api.github.com/repos/lionleaf/dwitter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lionleaf/dwitter/merges","archive_url":"https://api.github.com/repos/lionleaf/dwitter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lionleaf/dwitter/downloads","issues_url":"https://api.github.com/repos/lionleaf/dwitter/issues{/number}","pulls_url":"https://api.github.com/repos/lionleaf/dwitter/pulls{/number}","milestones_url":"https://api.github.com/repos/lionleaf/dwitter/milestones{/number}","notifications_url":"https://api.github.com/repos/lionleaf/dwitter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lionleaf/dwitter/labels{/name}","releases_url":"https://api.github.com/repos/lionleaf/dwitter/releases{/id}","deployments_url":"https://api.github.com/repos/lionleaf/dwitter/deployments","created_at":"2015-12-30T00:24:39Z","updated_at":"2016-04-20T23:48:54Z","pushed_at":"2016-05-20T05:30:02Z","git_url":"git://github.com/lionleaf/dwitter.git","ssh_url":"git@github.com:lionleaf/dwitter.git","clone_url":"https://github.com/lionleaf/dwitter.git","svn_url":"https://github.com/lionleaf/dwitter","homepage":"","size":157,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":12,"forks":3,"open_issues":12,"watchers":3,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/lionleaf/dwitter/pulls/32"},"html":{"href":"https://github.com/lionleaf/dwitter/pull/32"},"issue":{"href":"https://api.github.com/repos/lionleaf/dwitter/issues/32"},"comments":{"href":"https://api.github.com/repos/lionleaf/dwitter/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/lionleaf/dwitter/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/lionleaf/dwitter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lionleaf/dwitter/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/lionleaf/dwitter/statuses/d456cf59993a2671a987a9895045b29bf0c33468"}}}}
{"actor":{"display_login":"stianjensen"}}