{"action":"created","comment":{"url":"https://api.github.com/repos/andela/suyabay/pulls/comments/52941809","id":52941809,"diff_hunk":"@@ -1,55 +1,67 @@\n-$(document).ready(function(){\n-\n-\t$(\".comment-submit\").on(\"click\", function(){\n-\t\t\n-\t\tvar comment       = $(\"#comment-field\").val();\n-\t\tvar avatar        = $(this).data(\"avatar\");\n-\t\tvar comment_count = parseInt($(this).data(\"comment-count\")) + 1;\n-\t\tvar token         = $(this).data(\"token\");\n-\n-\t\tvar url        = \"/comment\";\n-\t\tvar user_id    = $(\"#user_id\").val();\n-\t\tvar episode_id = $(\"#episode_id\").val();\n-\n-\t\tvar data =\n-\t\t\t{\n-\t\t\t\tparameter  :\n-\t\t\t\t\t{\n-\t\t\t\t\t\t_token     : token,\n-\t\t\t\t\t\tuser_id    : user_id,\n-\t\t\t\t\t\tepisode_id : episode_id,\n-\t\t\t\t\t\tcomment    : comment\n-\t\t\t\t\t}\n-\t\t\t}\n-\t\tif (comment.length > 0) {\n-\t\t\t//Process AJAX request\n-\t\t\t$.ajax({\n-\t\t\t\turl    : url,\n-\t\t\t\ttype   : \"POST\",\n-\t\t\t\tdata   : data.parameter,\n-\n-\t\t\t\tsuccess: function(response) {\n-\t\t\t\t\tswitch (response.status_code)\n-\t\t\t\t\t{\n-\t\t\t\t\t\tcase 200:\n-\n-\t\t\t\t\t\t\t//Increment comment upon successful submission\n-\t\t\t\t\t\t\t$(\"#comment-count\").html(\" \"+comment_count);\n-\n-\t\t\t\t\t\t\t//Append comment to the last comment in the element\n-\t\t\t\t\t\t\t$(\".load_comment\").last().append('<div id=\"show_comment\" class=\"collection-item avatar show_comment' +'\"><div class=\"row\"><div class=\"col s2\"><img src=\"'+ avatar +'\" alt=\"\" class=\"circle\"></div><div class=\"col s10\"><div class=\"textarea-wrapper\" placeholder=\"\">'+comment+'</div></div></div></div>');\n-\n-\t\t\t\t\t\t\t//Reset form data\n-\t\t\t\t\t\t\tdocument.getElementById(\"submit_comment\").reset();\n-\t\t\t\t\t\tbreak;\n-\n-\t\t\t\t\t\tdefault: return false;\n-\t\t\t\t\t}\n-\t\t\t\t}\n-\t\t\t});\n-\t\t}\n-\n-\t\treturn false;\n-\t});\n+$(document).ready(function() {\n+\n+    $('.comment-submit').on('click', function() {\n+\n+        var comment = $('#new-comment-field').val();\n+        var avatar = $(this).data('avatar');\n+        var comment_count = parseInt($(this).data('comment-count')) + 1;\n+        var token = $(this).data('token');\n+\n+        var url = '/comment';\n+        var user_id = $('#user_id').val();\n+        var episode_id = $('#episode_id').val();\n+\n+        var data = {\n+            parameter: {\n+                _token: token,\n+                episode_id: episode_id,\n+                comment: comment\n+            }\n+        }\n+        if (comment.length > 0) {\n+            //Process AJAX request\n+            $.ajax({\n+                url: url,\n+                type: 'POST',\n+                data: data.parameter,\n+\n+                success: function(response) {\n+                    switch (response.status_code) {\n+                        case 200:\n+\n+                            //Increment comment upon successful submission\n+                            $('#comment-count').html(' ' + comment_count);\n+\n+                            var newComment = '<div id=\"show_comment\" class=\"collection-item avatar show_comment\">';\n+                            newComment += '<div class=\"row\">';\n+                            newComment += '<div class=\"col s2\"><img src=\"' + avatar + '\" alt=\"\" class=\"circle\"></div>';\n+                            newComment += '<div class=\"col s10\">';\n+                            newComment += '<div class=\"textarea-wrapper\" data-comment-id=\"' + response.commentId + '\">';\n+                            newComment += '<span>' + comment + '</span>';\n+\n+\n+                            newComment += '<div class=\"update-actions pull-right\">';\n+                            newComment += ' <a href=\"#\" id=\"comment_action_caret\" class=\"fa fa-bars no-style-link\"></a> ';\n+                            newComment += ' <div id=\"comment_actions\" style=\"display:none\">';\n+                            newComment += '<a href=\"#\" class=\"fa fa-pencil comment-action-edit no-style-link\" data-commentId=\"' + response.commentId + '\"></a>';\n+                            newComment += '<a href=\"#\" class=\"fa fa-trash comment-action-delete no-style-link\" data-commentId=\"' + response.commentId + '\"></a>';\n+                            newComment += '</div>';\n+                            newComment += '</div>';\n+                            newComment += '</div></div></div></div>';\n+\n+                            $(\".load_comment\").last().append(newComment);","path":"public/js/comment.js","position":105,"original_position":105,"commit_id":"95ec5bfd9b11828f654ce2f6f8105358e0dc7494","original_commit_id":"95ec5bfd9b11828f654ce2f6f8105358e0dc7494","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Mixed double and single quotes.","created_at":"2016-02-15T20:44:43Z","updated_at":"2016-02-15T20:44:43Z","html_url":"https://github.com/andela/suyabay/pull/164#discussion_r52941809","pull_request_url":"https://api.github.com/repos/andela/suyabay/pulls/164","_links":{"self":{"href":"https://api.github.com/repos/andela/suyabay/pulls/comments/52941809"},"html":{"href":"https://github.com/andela/suyabay/pull/164#discussion_r52941809"},"pull_request":{"href":"https://api.github.com/repos/andela/suyabay/pulls/164"}}},"pull_request":{"url":"https://api.github.com/repos/andela/suyabay/pulls/164","id":59396294,"html_url":"https://github.com/andela/suyabay/pull/164","diff_url":"https://github.com/andela/suyabay/pull/164.diff","patch_url":"https://github.com/andela/suyabay/pull/164.patch","issue_url":"https://api.github.com/repos/andela/suyabay/issues/164","number":164,"state":"open","locked":false,"title":"[Feature] [#112876091] Comments Update Feature","user":{"login":"andela-jkariuki","id":16223627,"avatar_url":"https://avatars.githubusercontent.com/u/16223627?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-jkariuki","html_url":"https://github.com/andela-jkariuki","followers_url":"https://api.github.com/users/andela-jkariuki/followers","following_url":"https://api.github.com/users/andela-jkariuki/following{/other_user}","gists_url":"https://api.github.com/users/andela-jkariuki/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-jkariuki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-jkariuki/subscriptions","organizations_url":"https://api.github.com/users/andela-jkariuki/orgs","repos_url":"https://api.github.com/users/andela-jkariuki/repos","events_url":"https://api.github.com/users/andela-jkariuki/events{/privacy}","received_events_url":"https://api.github.com/users/andela-jkariuki/received_events","type":"User","site_admin":false},"body":" A user should be able to edit and delete his comment on an episode","created_at":"2016-02-15T17:57:02Z","updated_at":"2016-02-15T20:44:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dcf1bd33538d09e5a2496f42270628321fbbb57d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/andela/suyabay/pulls/164/commits","review_comments_url":"https://api.github.com/repos/andela/suyabay/pulls/164/comments","review_comment_url":"https://api.github.com/repos/andela/suyabay/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela/suyabay/issues/164/comments","statuses_url":"https://api.github.com/repos/andela/suyabay/statuses/95ec5bfd9b11828f654ce2f6f8105358e0dc7494","head":{"label":"andela:feature/commentsupdate","ref":"feature/commentsupdate","sha":"95ec5bfd9b11828f654ce2f6f8105358e0dc7494","user":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":41855319,"name":"suyabay","full_name":"andela/suyabay","owner":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/suyabay","description":"Awesome Podcast FM Network for Suya Lovers","fork":false,"url":"https://api.github.com/repos/andela/suyabay","forks_url":"https://api.github.com/repos/andela/suyabay/forks","keys_url":"https://api.github.com/repos/andela/suyabay/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/suyabay/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/suyabay/teams","hooks_url":"https://api.github.com/repos/andela/suyabay/hooks","issue_events_url":"https://api.github.com/repos/andela/suyabay/issues/events{/number}","events_url":"https://api.github.com/repos/andela/suyabay/events","assignees_url":"https://api.github.com/repos/andela/suyabay/assignees{/user}","branches_url":"https://api.github.com/repos/andela/suyabay/branches{/branch}","tags_url":"https://api.github.com/repos/andela/suyabay/tags","blobs_url":"https://api.github.com/repos/andela/suyabay/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/suyabay/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/suyabay/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/suyabay/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/suyabay/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/suyabay/languages","stargazers_url":"https://api.github.com/repos/andela/suyabay/stargazers","contributors_url":"https://api.github.com/repos/andela/suyabay/contributors","subscribers_url":"https://api.github.com/repos/andela/suyabay/subscribers","subscription_url":"https://api.github.com/repos/andela/suyabay/subscription","commits_url":"https://api.github.com/repos/andela/suyabay/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/suyabay/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/suyabay/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/suyabay/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/suyabay/contents/{+path}","compare_url":"https://api.github.com/repos/andela/suyabay/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/suyabay/merges","archive_url":"https://api.github.com/repos/andela/suyabay/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/suyabay/downloads","issues_url":"https://api.github.com/repos/andela/suyabay/issues{/number}","pulls_url":"https://api.github.com/repos/andela/suyabay/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/suyabay/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/suyabay/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/suyabay/labels{/name}","releases_url":"https://api.github.com/repos/andela/suyabay/releases{/id}","deployments_url":"https://api.github.com/repos/andela/suyabay/deployments","created_at":"2015-09-03T11:00:56Z","updated_at":"2016-01-23T19:28:22Z","pushed_at":"2016-02-15T20:43:55Z","git_url":"git://github.com/andela/suyabay.git","ssh_url":"git@github.com:andela/suyabay.git","clone_url":"https://github.com/andela/suyabay.git","svn_url":"https://github.com/andela/suyabay","homepage":"https://suyabay-staging.herokuapp.com","size":16310,"stargazers_count":4,"watchers_count":4,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":9,"forks":3,"open_issues":9,"watchers":4,"default_branch":"staging"}},"base":{"label":"andela:staging","ref":"staging","sha":"24b103dacfd05991d00ea825accf629232c2172f","user":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":41855319,"name":"suyabay","full_name":"andela/suyabay","owner":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/suyabay","description":"Awesome Podcast FM Network for Suya Lovers","fork":false,"url":"https://api.github.com/repos/andela/suyabay","forks_url":"https://api.github.com/repos/andela/suyabay/forks","keys_url":"https://api.github.com/repos/andela/suyabay/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/suyabay/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/suyabay/teams","hooks_url":"https://api.github.com/repos/andela/suyabay/hooks","issue_events_url":"https://api.github.com/repos/andela/suyabay/issues/events{/number}","events_url":"https://api.github.com/repos/andela/suyabay/events","assignees_url":"https://api.github.com/repos/andela/suyabay/assignees{/user}","branches_url":"https://api.github.com/repos/andela/suyabay/branches{/branch}","tags_url":"https://api.github.com/repos/andela/suyabay/tags","blobs_url":"https://api.github.com/repos/andela/suyabay/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/suyabay/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/suyabay/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/suyabay/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/suyabay/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/suyabay/languages","stargazers_url":"https://api.github.com/repos/andela/suyabay/stargazers","contributors_url":"https://api.github.com/repos/andela/suyabay/contributors","subscribers_url":"https://api.github.com/repos/andela/suyabay/subscribers","subscription_url":"https://api.github.com/repos/andela/suyabay/subscription","commits_url":"https://api.github.com/repos/andela/suyabay/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/suyabay/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/suyabay/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/suyabay/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/suyabay/contents/{+path}","compare_url":"https://api.github.com/repos/andela/suyabay/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/suyabay/merges","archive_url":"https://api.github.com/repos/andela/suyabay/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/suyabay/downloads","issues_url":"https://api.github.com/repos/andela/suyabay/issues{/number}","pulls_url":"https://api.github.com/repos/andela/suyabay/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/suyabay/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/suyabay/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/suyabay/labels{/name}","releases_url":"https://api.github.com/repos/andela/suyabay/releases{/id}","deployments_url":"https://api.github.com/repos/andela/suyabay/deployments","created_at":"2015-09-03T11:00:56Z","updated_at":"2016-01-23T19:28:22Z","pushed_at":"2016-02-15T20:43:55Z","git_url":"git://github.com/andela/suyabay.git","ssh_url":"git@github.com:andela/suyabay.git","clone_url":"https://github.com/andela/suyabay.git","svn_url":"https://github.com/andela/suyabay","homepage":"https://suyabay-staging.herokuapp.com","size":16310,"stargazers_count":4,"watchers_count":4,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":9,"forks":3,"open_issues":9,"watchers":4,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/andela/suyabay/pulls/164"},"html":{"href":"https://github.com/andela/suyabay/pull/164"},"issue":{"href":"https://api.github.com/repos/andela/suyabay/issues/164"},"comments":{"href":"https://api.github.com/repos/andela/suyabay/issues/164/comments"},"review_comments":{"href":"https://api.github.com/repos/andela/suyabay/pulls/164/comments"},"review_comment":{"href":"https://api.github.com/repos/andela/suyabay/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela/suyabay/pulls/164/commits"},"statuses":{"href":"https://api.github.com/repos/andela/suyabay/statuses/95ec5bfd9b11828f654ce2f6f8105358e0dc7494"}}}}