{"action":"created","comment":{"url":"https://api.github.com/repos/cyclestreets/cyclescape/pulls/comments/49222785","id":49222785,"diff_hunk":"@@ -2,18 +2,26 @@ class MessageThread::SubscriptionsController < MessageThread::BaseController\n   filter_access_to :all, attribute_check: true, load_method: :load_thread\n \n   def create\n-    if @thread.add_subscriber current_user\n-      set_flash_message :success\n-    else\n-      set_flash_message :failure\n+    respond_to do |format|\n+      if  @thread.add_subscriber current_user\n+        set_flash_message :success\n+        format.html { redirect_to thread_path @thread }\n+        format.js   { }\n+      else\n+        set_flash_message :failure\n+        format.html { redirect_to thread_path @thread }\n+        format.js   { }\n+      end\n     end\n-    redirect_to thread_path @thread","path":"app/controllers/message_thread/subscriptions_controller.rb","position":19,"original_position":19,"commit_id":"f57098f722f4d4124dc58c48851fa33562312d71","original_commit_id":"f57098f722f4d4124dc58c48851fa33562312d71","user":{"login":"nikolai-b","id":6289830,"avatar_url":"https://avatars.githubusercontent.com/u/6289830?v=3","gravatar_id":"","url":"https://api.github.com/users/nikolai-b","html_url":"https://github.com/nikolai-b","followers_url":"https://api.github.com/users/nikolai-b/followers","following_url":"https://api.github.com/users/nikolai-b/following{/other_user}","gists_url":"https://api.github.com/users/nikolai-b/gists{/gist_id}","starred_url":"https://api.github.com/users/nikolai-b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikolai-b/subscriptions","organizations_url":"https://api.github.com/users/nikolai-b/orgs","repos_url":"https://api.github.com/users/nikolai-b/repos","events_url":"https://api.github.com/users/nikolai-b/events{/privacy}","received_events_url":"https://api.github.com/users/nikolai-b/received_events","type":"User","site_admin":false},"body":"Can't you just have the format after the `if`\r\n```ruby\r\nif  @thread.add_subscriber current_user\r\n  set_flash_message :success\r\nelse\r\n  set_flash_message :failure\r\nend\r\nformat.html { redirect_to thread_path @thread }\r\nformat.js   { }\r\n```\r\n?","created_at":"2016-01-08T18:51:12Z","updated_at":"2016-01-08T18:51:12Z","html_url":"https://github.com/cyclestreets/cyclescape/pull/476#discussion_r49222785","pull_request_url":"https://api.github.com/repos/cyclestreets/cyclescape/pulls/476","_links":{"self":{"href":"https://api.github.com/repos/cyclestreets/cyclescape/pulls/comments/49222785"},"html":{"href":"https://github.com/cyclestreets/cyclescape/pull/476#discussion_r49222785"},"pull_request":{"href":"https://api.github.com/repos/cyclestreets/cyclescape/pulls/476"}}},"pull_request":{"url":"https://api.github.com/repos/cyclestreets/cyclescape/pulls/476","id":55433498,"html_url":"https://github.com/cyclestreets/cyclescape/pull/476","diff_url":"https://github.com/cyclestreets/cyclescape/pull/476.diff","patch_url":"https://github.com/cyclestreets/cyclescape/pull/476.patch","issue_url":"https://api.github.com/repos/cyclestreets/cyclescape/issues/476","number":476,"state":"open","locked":false,"title":"Issue 462","user":{"login":"panchew","id":308737,"avatar_url":"https://avatars.githubusercontent.com/u/308737?v=3","gravatar_id":"","url":"https://api.github.com/users/panchew","html_url":"https://github.com/panchew","followers_url":"https://api.github.com/users/panchew/followers","following_url":"https://api.github.com/users/panchew/following{/other_user}","gists_url":"https://api.github.com/users/panchew/gists{/gist_id}","starred_url":"https://api.github.com/users/panchew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panchew/subscriptions","organizations_url":"https://api.github.com/users/panchew/orgs","repos_url":"https://api.github.com/users/panchew/repos","events_url":"https://api.github.com/users/panchew/events{/privacy}","received_events_url":"https://api.github.com/users/panchew/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-08T07:48:27Z","updated_at":"2016-01-08T18:51:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ab97652ebd49e96558df98f92710320707ef2f47","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cyclestreets/cyclescape/pulls/476/commits","review_comments_url":"https://api.github.com/repos/cyclestreets/cyclescape/pulls/476/comments","review_comment_url":"https://api.github.com/repos/cyclestreets/cyclescape/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cyclestreets/cyclescape/issues/476/comments","statuses_url":"https://api.github.com/repos/cyclestreets/cyclescape/statuses/f57098f722f4d4124dc58c48851fa33562312d71","head":{"label":"panchew:issue_462","ref":"issue_462","sha":"f57098f722f4d4124dc58c48851fa33562312d71","user":{"login":"panchew","id":308737,"avatar_url":"https://avatars.githubusercontent.com/u/308737?v=3","gravatar_id":"","url":"https://api.github.com/users/panchew","html_url":"https://github.com/panchew","followers_url":"https://api.github.com/users/panchew/followers","following_url":"https://api.github.com/users/panchew/following{/other_user}","gists_url":"https://api.github.com/users/panchew/gists{/gist_id}","starred_url":"https://api.github.com/users/panchew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panchew/subscriptions","organizations_url":"https://api.github.com/users/panchew/orgs","repos_url":"https://api.github.com/users/panchew/repos","events_url":"https://api.github.com/users/panchew/events{/privacy}","received_events_url":"https://api.github.com/users/panchew/received_events","type":"User","site_admin":false},"repo":{"id":48708085,"name":"cyclescape","full_name":"panchew/cyclescape","owner":{"login":"panchew","id":308737,"avatar_url":"https://avatars.githubusercontent.com/u/308737?v=3","gravatar_id":"","url":"https://api.github.com/users/panchew","html_url":"https://github.com/panchew","followers_url":"https://api.github.com/users/panchew/followers","following_url":"https://api.github.com/users/panchew/following{/other_user}","gists_url":"https://api.github.com/users/panchew/gists{/gist_id}","starred_url":"https://api.github.com/users/panchew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panchew/subscriptions","organizations_url":"https://api.github.com/users/panchew/orgs","repos_url":"https://api.github.com/users/panchew/repos","events_url":"https://api.github.com/users/panchew/events{/privacy}","received_events_url":"https://api.github.com/users/panchew/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/panchew/cyclescape","description":"Cyclescape - cycle campaign group toolkit","fork":true,"url":"https://api.github.com/repos/panchew/cyclescape","forks_url":"https://api.github.com/repos/panchew/cyclescape/forks","keys_url":"https://api.github.com/repos/panchew/cyclescape/keys{/key_id}","collaborators_url":"https://api.github.com/repos/panchew/cyclescape/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/panchew/cyclescape/teams","hooks_url":"https://api.github.com/repos/panchew/cyclescape/hooks","issue_events_url":"https://api.github.com/repos/panchew/cyclescape/issues/events{/number}","events_url":"https://api.github.com/repos/panchew/cyclescape/events","assignees_url":"https://api.github.com/repos/panchew/cyclescape/assignees{/user}","branches_url":"https://api.github.com/repos/panchew/cyclescape/branches{/branch}","tags_url":"https://api.github.com/repos/panchew/cyclescape/tags","blobs_url":"https://api.github.com/repos/panchew/cyclescape/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/panchew/cyclescape/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/panchew/cyclescape/git/refs{/sha}","trees_url":"https://api.github.com/repos/panchew/cyclescape/git/trees{/sha}","statuses_url":"https://api.github.com/repos/panchew/cyclescape/statuses/{sha}","languages_url":"https://api.github.com/repos/panchew/cyclescape/languages","stargazers_url":"https://api.github.com/repos/panchew/cyclescape/stargazers","contributors_url":"https://api.github.com/repos/panchew/cyclescape/contributors","subscribers_url":"https://api.github.com/repos/panchew/cyclescape/subscribers","subscription_url":"https://api.github.com/repos/panchew/cyclescape/subscription","commits_url":"https://api.github.com/repos/panchew/cyclescape/commits{/sha}","git_commits_url":"https://api.github.com/repos/panchew/cyclescape/git/commits{/sha}","comments_url":"https://api.github.com/repos/panchew/cyclescape/comments{/number}","issue_comment_url":"https://api.github.com/repos/panchew/cyclescape/issues/comments{/number}","contents_url":"https://api.github.com/repos/panchew/cyclescape/contents/{+path}","compare_url":"https://api.github.com/repos/panchew/cyclescape/compare/{base}...{head}","merges_url":"https://api.github.com/repos/panchew/cyclescape/merges","archive_url":"https://api.github.com/repos/panchew/cyclescape/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/panchew/cyclescape/downloads","issues_url":"https://api.github.com/repos/panchew/cyclescape/issues{/number}","pulls_url":"https://api.github.com/repos/panchew/cyclescape/pulls{/number}","milestones_url":"https://api.github.com/repos/panchew/cyclescape/milestones{/number}","notifications_url":"https://api.github.com/repos/panchew/cyclescape/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/panchew/cyclescape/labels{/name}","releases_url":"https://api.github.com/repos/panchew/cyclescape/releases{/id}","created_at":"2015-12-28T19:11:26Z","updated_at":"2015-12-28T19:11:27Z","pushed_at":"2016-01-08T07:44:36Z","git_url":"git://github.com/panchew/cyclescape.git","ssh_url":"git@github.com:panchew/cyclescape.git","clone_url":"https://github.com/panchew/cyclescape.git","svn_url":"https://github.com/panchew/cyclescape","homepage":"http://www.cyclescape.org/ and http://www.cyklistesobe.cz/","size":8555,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"cyclestreets:master","ref":"master","sha":"9497ccae2c7787a679b98b5ecd775005f5d63996","user":{"login":"cyclestreets","id":361419,"avatar_url":"https://avatars.githubusercontent.com/u/361419?v=3","gravatar_id":"","url":"https://api.github.com/users/cyclestreets","html_url":"https://github.com/cyclestreets","followers_url":"https://api.github.com/users/cyclestreets/followers","following_url":"https://api.github.com/users/cyclestreets/following{/other_user}","gists_url":"https://api.github.com/users/cyclestreets/gists{/gist_id}","starred_url":"https://api.github.com/users/cyclestreets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyclestreets/subscriptions","organizations_url":"https://api.github.com/users/cyclestreets/orgs","repos_url":"https://api.github.com/users/cyclestreets/repos","events_url":"https://api.github.com/users/cyclestreets/events{/privacy}","received_events_url":"https://api.github.com/users/cyclestreets/received_events","type":"Organization","site_admin":false},"repo":{"id":2304599,"name":"cyclescape","full_name":"cyclestreets/cyclescape","owner":{"login":"cyclestreets","id":361419,"avatar_url":"https://avatars.githubusercontent.com/u/361419?v=3","gravatar_id":"","url":"https://api.github.com/users/cyclestreets","html_url":"https://github.com/cyclestreets","followers_url":"https://api.github.com/users/cyclestreets/followers","following_url":"https://api.github.com/users/cyclestreets/following{/other_user}","gists_url":"https://api.github.com/users/cyclestreets/gists{/gist_id}","starred_url":"https://api.github.com/users/cyclestreets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyclestreets/subscriptions","organizations_url":"https://api.github.com/users/cyclestreets/orgs","repos_url":"https://api.github.com/users/cyclestreets/repos","events_url":"https://api.github.com/users/cyclestreets/events{/privacy}","received_events_url":"https://api.github.com/users/cyclestreets/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cyclestreets/cyclescape","description":"Cyclescape - cycle campaign group toolkit","fork":false,"url":"https://api.github.com/repos/cyclestreets/cyclescape","forks_url":"https://api.github.com/repos/cyclestreets/cyclescape/forks","keys_url":"https://api.github.com/repos/cyclestreets/cyclescape/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cyclestreets/cyclescape/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cyclestreets/cyclescape/teams","hooks_url":"https://api.github.com/repos/cyclestreets/cyclescape/hooks","issue_events_url":"https://api.github.com/repos/cyclestreets/cyclescape/issues/events{/number}","events_url":"https://api.github.com/repos/cyclestreets/cyclescape/events","assignees_url":"https://api.github.com/repos/cyclestreets/cyclescape/assignees{/user}","branches_url":"https://api.github.com/repos/cyclestreets/cyclescape/branches{/branch}","tags_url":"https://api.github.com/repos/cyclestreets/cyclescape/tags","blobs_url":"https://api.github.com/repos/cyclestreets/cyclescape/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cyclestreets/cyclescape/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cyclestreets/cyclescape/git/refs{/sha}","trees_url":"https://api.github.com/repos/cyclestreets/cyclescape/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cyclestreets/cyclescape/statuses/{sha}","languages_url":"https://api.github.com/repos/cyclestreets/cyclescape/languages","stargazers_url":"https://api.github.com/repos/cyclestreets/cyclescape/stargazers","contributors_url":"https://api.github.com/repos/cyclestreets/cyclescape/contributors","subscribers_url":"https://api.github.com/repos/cyclestreets/cyclescape/subscribers","subscription_url":"https://api.github.com/repos/cyclestreets/cyclescape/subscription","commits_url":"https://api.github.com/repos/cyclestreets/cyclescape/commits{/sha}","git_commits_url":"https://api.github.com/repos/cyclestreets/cyclescape/git/commits{/sha}","comments_url":"https://api.github.com/repos/cyclestreets/cyclescape/comments{/number}","issue_comment_url":"https://api.github.com/repos/cyclestreets/cyclescape/issues/comments{/number}","contents_url":"https://api.github.com/repos/cyclestreets/cyclescape/contents/{+path}","compare_url":"https://api.github.com/repos/cyclestreets/cyclescape/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cyclestreets/cyclescape/merges","archive_url":"https://api.github.com/repos/cyclestreets/cyclescape/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cyclestreets/cyclescape/downloads","issues_url":"https://api.github.com/repos/cyclestreets/cyclescape/issues{/number}","pulls_url":"https://api.github.com/repos/cyclestreets/cyclescape/pulls{/number}","milestones_url":"https://api.github.com/repos/cyclestreets/cyclescape/milestones{/number}","notifications_url":"https://api.github.com/repos/cyclestreets/cyclescape/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cyclestreets/cyclescape/labels{/name}","releases_url":"https://api.github.com/repos/cyclestreets/cyclescape/releases{/id}","created_at":"2011-08-31T22:35:34Z","updated_at":"2015-09-17T23:17:30Z","pushed_at":"2016-01-08T07:48:27Z","git_url":"git://github.com/cyclestreets/cyclescape.git","ssh_url":"git@github.com:cyclestreets/cyclescape.git","clone_url":"https://github.com/cyclestreets/cyclescape.git","svn_url":"https://github.com/cyclestreets/cyclescape","homepage":"http://www.cyclescape.org/ and http://www.cyklistesobe.cz/","size":8605,"stargazers_count":22,"watchers_count":22,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":214,"forks":13,"open_issues":214,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cyclestreets/cyclescape/pulls/476"},"html":{"href":"https://github.com/cyclestreets/cyclescape/pull/476"},"issue":{"href":"https://api.github.com/repos/cyclestreets/cyclescape/issues/476"},"comments":{"href":"https://api.github.com/repos/cyclestreets/cyclescape/issues/476/comments"},"review_comments":{"href":"https://api.github.com/repos/cyclestreets/cyclescape/pulls/476/comments"},"review_comment":{"href":"https://api.github.com/repos/cyclestreets/cyclescape/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cyclestreets/cyclescape/pulls/476/commits"},"statuses":{"href":"https://api.github.com/repos/cyclestreets/cyclescape/statuses/f57098f722f4d4124dc58c48851fa33562312d71"}}}}