{"action":"created","comment":{"url":"https://api.github.com/repos/kickupduster/desk/pulls/comments/86341344","pull_request_review_id":7003868,"id":86341344,"diff_hunk":"@@ -46,19 +52,43 @@ def search\n   end\n \n   def change_state\n+    if params[:advertisement][:comment].present?\n+      @comment = Comment.new(comment_params)\n+      @comment.advertisement = @advertisement\n+      @comment.save\n+    else\n+      @advertisement.comment.destroy if @advertisement.comment\n+    end\n+\n+    @from_state = @advertisement.state\n+\n     @advertisement.send(advertisement_params[:state])\n     @advertisement.save\n \n+    @log = Log.create(user: current_user.name, advertisement_id: @advertisement.id,\n+                      from_state: @from_state,  to_state: @advertisement.state)","path":"app/controllers/advertisements_controller.rb","position":38,"original_position":38,"commit_id":"7b94a9a967a208149cf7e31938dcf3e47b86d706","original_commit_id":"7b94a9a967a208149cf7e31938dcf3e47b86d706","user":{"login":"iermakovets","id":7969336,"avatar_url":"https://avatars.githubusercontent.com/u/7969336?v=3","gravatar_id":"","url":"https://api.github.com/users/iermakovets","html_url":"https://github.com/iermakovets","followers_url":"https://api.github.com/users/iermakovets/followers","following_url":"https://api.github.com/users/iermakovets/following{/other_user}","gists_url":"https://api.github.com/users/iermakovets/gists{/gist_id}","starred_url":"https://api.github.com/users/iermakovets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iermakovets/subscriptions","organizations_url":"https://api.github.com/users/iermakovets/orgs","repos_url":"https://api.github.com/users/iermakovets/repos","events_url":"https://api.github.com/users/iermakovets/events{/privacy}","received_events_url":"https://api.github.com/users/iermakovets/received_events","type":"User","site_admin":false},"body":"Move this duplicated logic to separete method (see line 36-37)","created_at":"2016-11-03T13:30:00Z","updated_at":"2016-11-03T13:30:59Z","html_url":"https://github.com/kickupduster/desk/pull/11#discussion_r86341344","pull_request_url":"https://api.github.com/repos/kickupduster/desk/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/kickupduster/desk/pulls/comments/86341344"},"html":{"href":"https://github.com/kickupduster/desk/pull/11#discussion_r86341344"},"pull_request":{"href":"https://api.github.com/repos/kickupduster/desk/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/kickupduster/desk/pulls/11","id":91426004,"html_url":"https://github.com/kickupduster/desk/pull/11","diff_url":"https://github.com/kickupduster/desk/pull/11.diff","patch_url":"https://github.com/kickupduster/desk/pull/11.patch","issue_url":"https://api.github.com/repos/kickupduster/desk/issues/11","number":11,"state":"open","locked":false,"title":"Add log advert","user":{"login":"kickupduster","id":19334599,"avatar_url":"https://avatars.githubusercontent.com/u/19334599?v=3","gravatar_id":"","url":"https://api.github.com/users/kickupduster","html_url":"https://github.com/kickupduster","followers_url":"https://api.github.com/users/kickupduster/followers","following_url":"https://api.github.com/users/kickupduster/following{/other_user}","gists_url":"https://api.github.com/users/kickupduster/gists{/gist_id}","starred_url":"https://api.github.com/users/kickupduster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kickupduster/subscriptions","organizations_url":"https://api.github.com/users/kickupduster/orgs","repos_url":"https://api.github.com/users/kickupduster/repos","events_url":"https://api.github.com/users/kickupduster/events{/privacy}","received_events_url":"https://api.github.com/users/kickupduster/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-28T18:08:20Z","updated_at":"2016-11-03T13:30:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fb7fda55bd73ff7da4c721a77b90696bf40df8ef","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kickupduster/desk/pulls/11/commits","review_comments_url":"https://api.github.com/repos/kickupduster/desk/pulls/11/comments","review_comment_url":"https://api.github.com/repos/kickupduster/desk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kickupduster/desk/issues/11/comments","statuses_url":"https://api.github.com/repos/kickupduster/desk/statuses/7b94a9a967a208149cf7e31938dcf3e47b86d706","head":{"label":"kickupduster:add-log-advert","ref":"add-log-advert","sha":"7b94a9a967a208149cf7e31938dcf3e47b86d706","user":{"login":"kickupduster","id":19334599,"avatar_url":"https://avatars.githubusercontent.com/u/19334599?v=3","gravatar_id":"","url":"https://api.github.com/users/kickupduster","html_url":"https://github.com/kickupduster","followers_url":"https://api.github.com/users/kickupduster/followers","following_url":"https://api.github.com/users/kickupduster/following{/other_user}","gists_url":"https://api.github.com/users/kickupduster/gists{/gist_id}","starred_url":"https://api.github.com/users/kickupduster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kickupduster/subscriptions","organizations_url":"https://api.github.com/users/kickupduster/orgs","repos_url":"https://api.github.com/users/kickupduster/repos","events_url":"https://api.github.com/users/kickupduster/events{/privacy}","received_events_url":"https://api.github.com/users/kickupduster/received_events","type":"User","site_admin":false},"repo":{"id":71120686,"name":"desk","full_name":"kickupduster/desk","owner":{"login":"kickupduster","id":19334599,"avatar_url":"https://avatars.githubusercontent.com/u/19334599?v=3","gravatar_id":"","url":"https://api.github.com/users/kickupduster","html_url":"https://github.com/kickupduster","followers_url":"https://api.github.com/users/kickupduster/followers","following_url":"https://api.github.com/users/kickupduster/following{/other_user}","gists_url":"https://api.github.com/users/kickupduster/gists{/gist_id}","starred_url":"https://api.github.com/users/kickupduster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kickupduster/subscriptions","organizations_url":"https://api.github.com/users/kickupduster/orgs","repos_url":"https://api.github.com/users/kickupduster/repos","events_url":"https://api.github.com/users/kickupduster/events{/privacy}","received_events_url":"https://api.github.com/users/kickupduster/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kickupduster/desk","description":null,"fork":false,"url":"https://api.github.com/repos/kickupduster/desk","forks_url":"https://api.github.com/repos/kickupduster/desk/forks","keys_url":"https://api.github.com/repos/kickupduster/desk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kickupduster/desk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kickupduster/desk/teams","hooks_url":"https://api.github.com/repos/kickupduster/desk/hooks","issue_events_url":"https://api.github.com/repos/kickupduster/desk/issues/events{/number}","events_url":"https://api.github.com/repos/kickupduster/desk/events","assignees_url":"https://api.github.com/repos/kickupduster/desk/assignees{/user}","branches_url":"https://api.github.com/repos/kickupduster/desk/branches{/branch}","tags_url":"https://api.github.com/repos/kickupduster/desk/tags","blobs_url":"https://api.github.com/repos/kickupduster/desk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kickupduster/desk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kickupduster/desk/git/refs{/sha}","trees_url":"https://api.github.com/repos/kickupduster/desk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kickupduster/desk/statuses/{sha}","languages_url":"https://api.github.com/repos/kickupduster/desk/languages","stargazers_url":"https://api.github.com/repos/kickupduster/desk/stargazers","contributors_url":"https://api.github.com/repos/kickupduster/desk/contributors","subscribers_url":"https://api.github.com/repos/kickupduster/desk/subscribers","subscription_url":"https://api.github.com/repos/kickupduster/desk/subscription","commits_url":"https://api.github.com/repos/kickupduster/desk/commits{/sha}","git_commits_url":"https://api.github.com/repos/kickupduster/desk/git/commits{/sha}","comments_url":"https://api.github.com/repos/kickupduster/desk/comments{/number}","issue_comment_url":"https://api.github.com/repos/kickupduster/desk/issues/comments{/number}","contents_url":"https://api.github.com/repos/kickupduster/desk/contents/{+path}","compare_url":"https://api.github.com/repos/kickupduster/desk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kickupduster/desk/merges","archive_url":"https://api.github.com/repos/kickupduster/desk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kickupduster/desk/downloads","issues_url":"https://api.github.com/repos/kickupduster/desk/issues{/number}","pulls_url":"https://api.github.com/repos/kickupduster/desk/pulls{/number}","milestones_url":"https://api.github.com/repos/kickupduster/desk/milestones{/number}","notifications_url":"https://api.github.com/repos/kickupduster/desk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kickupduster/desk/labels{/name}","releases_url":"https://api.github.com/repos/kickupduster/desk/releases{/id}","deployments_url":"https://api.github.com/repos/kickupduster/desk/deployments","created_at":"2016-10-17T09:17:25Z","updated_at":"2016-10-17T09:31:46Z","pushed_at":"2016-11-02T11:44:23Z","git_url":"git://github.com/kickupduster/desk.git","ssh_url":"git@github.com:kickupduster/desk.git","clone_url":"https://github.com/kickupduster/desk.git","svn_url":"https://github.com/kickupduster/desk","homepage":null,"size":37311,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"kickupduster:master","ref":"master","sha":"4083f7b42fbd0e0e91061508a40207b3a274ffc6","user":{"login":"kickupduster","id":19334599,"avatar_url":"https://avatars.githubusercontent.com/u/19334599?v=3","gravatar_id":"","url":"https://api.github.com/users/kickupduster","html_url":"https://github.com/kickupduster","followers_url":"https://api.github.com/users/kickupduster/followers","following_url":"https://api.github.com/users/kickupduster/following{/other_user}","gists_url":"https://api.github.com/users/kickupduster/gists{/gist_id}","starred_url":"https://api.github.com/users/kickupduster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kickupduster/subscriptions","organizations_url":"https://api.github.com/users/kickupduster/orgs","repos_url":"https://api.github.com/users/kickupduster/repos","events_url":"https://api.github.com/users/kickupduster/events{/privacy}","received_events_url":"https://api.github.com/users/kickupduster/received_events","type":"User","site_admin":false},"repo":{"id":71120686,"name":"desk","full_name":"kickupduster/desk","owner":{"login":"kickupduster","id":19334599,"avatar_url":"https://avatars.githubusercontent.com/u/19334599?v=3","gravatar_id":"","url":"https://api.github.com/users/kickupduster","html_url":"https://github.com/kickupduster","followers_url":"https://api.github.com/users/kickupduster/followers","following_url":"https://api.github.com/users/kickupduster/following{/other_user}","gists_url":"https://api.github.com/users/kickupduster/gists{/gist_id}","starred_url":"https://api.github.com/users/kickupduster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kickupduster/subscriptions","organizations_url":"https://api.github.com/users/kickupduster/orgs","repos_url":"https://api.github.com/users/kickupduster/repos","events_url":"https://api.github.com/users/kickupduster/events{/privacy}","received_events_url":"https://api.github.com/users/kickupduster/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kickupduster/desk","description":null,"fork":false,"url":"https://api.github.com/repos/kickupduster/desk","forks_url":"https://api.github.com/repos/kickupduster/desk/forks","keys_url":"https://api.github.com/repos/kickupduster/desk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kickupduster/desk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kickupduster/desk/teams","hooks_url":"https://api.github.com/repos/kickupduster/desk/hooks","issue_events_url":"https://api.github.com/repos/kickupduster/desk/issues/events{/number}","events_url":"https://api.github.com/repos/kickupduster/desk/events","assignees_url":"https://api.github.com/repos/kickupduster/desk/assignees{/user}","branches_url":"https://api.github.com/repos/kickupduster/desk/branches{/branch}","tags_url":"https://api.github.com/repos/kickupduster/desk/tags","blobs_url":"https://api.github.com/repos/kickupduster/desk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kickupduster/desk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kickupduster/desk/git/refs{/sha}","trees_url":"https://api.github.com/repos/kickupduster/desk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kickupduster/desk/statuses/{sha}","languages_url":"https://api.github.com/repos/kickupduster/desk/languages","stargazers_url":"https://api.github.com/repos/kickupduster/desk/stargazers","contributors_url":"https://api.github.com/repos/kickupduster/desk/contributors","subscribers_url":"https://api.github.com/repos/kickupduster/desk/subscribers","subscription_url":"https://api.github.com/repos/kickupduster/desk/subscription","commits_url":"https://api.github.com/repos/kickupduster/desk/commits{/sha}","git_commits_url":"https://api.github.com/repos/kickupduster/desk/git/commits{/sha}","comments_url":"https://api.github.com/repos/kickupduster/desk/comments{/number}","issue_comment_url":"https://api.github.com/repos/kickupduster/desk/issues/comments{/number}","contents_url":"https://api.github.com/repos/kickupduster/desk/contents/{+path}","compare_url":"https://api.github.com/repos/kickupduster/desk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kickupduster/desk/merges","archive_url":"https://api.github.com/repos/kickupduster/desk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kickupduster/desk/downloads","issues_url":"https://api.github.com/repos/kickupduster/desk/issues{/number}","pulls_url":"https://api.github.com/repos/kickupduster/desk/pulls{/number}","milestones_url":"https://api.github.com/repos/kickupduster/desk/milestones{/number}","notifications_url":"https://api.github.com/repos/kickupduster/desk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kickupduster/desk/labels{/name}","releases_url":"https://api.github.com/repos/kickupduster/desk/releases{/id}","deployments_url":"https://api.github.com/repos/kickupduster/desk/deployments","created_at":"2016-10-17T09:17:25Z","updated_at":"2016-10-17T09:31:46Z","pushed_at":"2016-11-02T11:44:23Z","git_url":"git://github.com/kickupduster/desk.git","ssh_url":"git@github.com:kickupduster/desk.git","clone_url":"https://github.com/kickupduster/desk.git","svn_url":"https://github.com/kickupduster/desk","homepage":null,"size":37311,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kickupduster/desk/pulls/11"},"html":{"href":"https://github.com/kickupduster/desk/pull/11"},"issue":{"href":"https://api.github.com/repos/kickupduster/desk/issues/11"},"comments":{"href":"https://api.github.com/repos/kickupduster/desk/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/kickupduster/desk/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/kickupduster/desk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kickupduster/desk/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/kickupduster/desk/statuses/7b94a9a967a208149cf7e31938dcf3e47b86d706"}}}}
{"actor":{"display_login":"iermakovets"}}