{"action":"created","comment":{"url":"https://api.github.com/repos/gocd/gocd/pulls/comments/109867661","pull_request_review_id":30991350,"id":109867661,"diff_hunk":"@@ -0,0 +1,41 @@\n+##########################################################################\n+# Copyright 2017 ThoughtWorks, Inc.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+##########################################################################\n+\n+module Api\n+  module UsersHelper\n+\n+    def save_user(result, user)\n+      # sending empty array through JSON seems to become nil ????\n+      params[\"checkin_aliases\"] = [] if params.has_key?(\"checkin_aliases\") && params[\"checkin_aliases\"].nil?\n+\n+      checkin_aliases = if params[:checkin_aliases].is_a?(Array)\n+                          params[:checkin_aliases].join(',')\n+                        else\n+                          params[:checkin_aliases]\n+                        end\n+      user_service.save(user, to_tristate(params[:enabled]), to_tristate(params[:email_me]), params[:email], checkin_aliases, result)\n+    end\n+\n+    def load_user(username=params[:login_name])\n+      @user_to_operate = user_service.findUserByName(username)\n+\n+      if !@user_to_operate || @user_to_operate.instance_of?(com.thoughtworks.go.domain.NullUser)\n+        raise ApiV1::RecordNotFound","path":"server/webapp/WEB-INF/rails.new/app/helpers/api/users_helper.rb","position":36,"original_position":36,"commit_id":"8528443b7273a2c05ac2a821e6acaf31c551fed1","original_commit_id":"8528443b7273a2c05ac2a821e6acaf31c551fed1","user":{"login":"ketan","id":10598,"avatar_url":"https://avatars0.githubusercontent.com/u/10598?v=3","gravatar_id":"","url":"https://api.github.com/users/ketan","html_url":"https://github.com/ketan","followers_url":"https://api.github.com/users/ketan/followers","following_url":"https://api.github.com/users/ketan/following{/other_user}","gists_url":"https://api.github.com/users/ketan/gists{/gist_id}","starred_url":"https://api.github.com/users/ketan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ketan/subscriptions","organizations_url":"https://api.github.com/users/ketan/orgs","repos_url":"https://api.github.com/users/ketan/repos","events_url":"https://api.github.com/users/ketan/events{/privacy}","received_events_url":"https://api.github.com/users/ketan/received_events","type":"User","site_admin":false},"body":"To provide a more concrete example of why we don't share code between api versions —\r\n\r\nYou're raising an `ApiV1::RecordNotFound` which is only rescued by `ApiV1::BaseController`, `ApiV4::BaseController` will throw a 500 on seeing this exception.","created_at":"2017-04-05T09:21:42Z","updated_at":"2017-04-05T09:50:14Z","html_url":"https://github.com/gocd/gocd/pull/3360#discussion_r109867661","pull_request_url":"https://api.github.com/repos/gocd/gocd/pulls/3360","_links":{"self":{"href":"https://api.github.com/repos/gocd/gocd/pulls/comments/109867661"},"html":{"href":"https://github.com/gocd/gocd/pull/3360#discussion_r109867661"},"pull_request":{"href":"https://api.github.com/repos/gocd/gocd/pulls/3360"}}},"pull_request":{"url":"https://api.github.com/repos/gocd/gocd/pulls/3360","id":114326420,"html_url":"https://github.com/gocd/gocd/pull/3360","diff_url":"https://github.com/gocd/gocd/pull/3360.diff","patch_url":"https://github.com/gocd/gocd/pull/3360.patch","issue_url":"https://api.github.com/repos/gocd/gocd/issues/3360","number":3360,"state":"open","locked":false,"title":"Convert User Preferences to mithril SPA","user":{"login":"marques-work","id":723642,"avatar_url":"https://avatars0.githubusercontent.com/u/723642?v=3","gravatar_id":"","url":"https://api.github.com/users/marques-work","html_url":"https://github.com/marques-work","followers_url":"https://api.github.com/users/marques-work/followers","following_url":"https://api.github.com/users/marques-work/following{/other_user}","gists_url":"https://api.github.com/users/marques-work/gists{/gist_id}","starred_url":"https://api.github.com/users/marques-work/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marques-work/subscriptions","organizations_url":"https://api.github.com/users/marques-work/orgs","repos_url":"https://api.github.com/users/marques-work/repos","events_url":"https://api.github.com/users/marques-work/events{/privacy}","received_events_url":"https://api.github.com/users/marques-work/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-04-05T08:57:17Z","updated_at":"2017-04-05T09:50:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75ca1ff2a282ae59c80612b4ddd585d037d2a032","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/gocd/gocd/pulls/3360/commits","review_comments_url":"https://api.github.com/repos/gocd/gocd/pulls/3360/comments","review_comment_url":"https://api.github.com/repos/gocd/gocd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gocd/gocd/issues/3360/comments","statuses_url":"https://api.github.com/repos/gocd/gocd/statuses/8528443b7273a2c05ac2a821e6acaf31c551fed1","head":{"label":"marques-work:user-pref-mithril-spa","ref":"user-pref-mithril-spa","sha":"8528443b7273a2c05ac2a821e6acaf31c551fed1","user":{"login":"marques-work","id":723642,"avatar_url":"https://avatars0.githubusercontent.com/u/723642?v=3","gravatar_id":"","url":"https://api.github.com/users/marques-work","html_url":"https://github.com/marques-work","followers_url":"https://api.github.com/users/marques-work/followers","following_url":"https://api.github.com/users/marques-work/following{/other_user}","gists_url":"https://api.github.com/users/marques-work/gists{/gist_id}","starred_url":"https://api.github.com/users/marques-work/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marques-work/subscriptions","organizations_url":"https://api.github.com/users/marques-work/orgs","repos_url":"https://api.github.com/users/marques-work/repos","events_url":"https://api.github.com/users/marques-work/events{/privacy}","received_events_url":"https://api.github.com/users/marques-work/received_events","type":"User","site_admin":false},"repo":{"id":82087106,"name":"gocd","full_name":"marques-work/gocd","owner":{"login":"marques-work","id":723642,"avatar_url":"https://avatars0.githubusercontent.com/u/723642?v=3","gravatar_id":"","url":"https://api.github.com/users/marques-work","html_url":"https://github.com/marques-work","followers_url":"https://api.github.com/users/marques-work/followers","following_url":"https://api.github.com/users/marques-work/following{/other_user}","gists_url":"https://api.github.com/users/marques-work/gists{/gist_id}","starred_url":"https://api.github.com/users/marques-work/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marques-work/subscriptions","organizations_url":"https://api.github.com/users/marques-work/orgs","repos_url":"https://api.github.com/users/marques-work/repos","events_url":"https://api.github.com/users/marques-work/events{/privacy}","received_events_url":"https://api.github.com/users/marques-work/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marques-work/gocd","description":"Main repository for GoCD - Continuous Delivery server","fork":true,"url":"https://api.github.com/repos/marques-work/gocd","forks_url":"https://api.github.com/repos/marques-work/gocd/forks","keys_url":"https://api.github.com/repos/marques-work/gocd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marques-work/gocd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marques-work/gocd/teams","hooks_url":"https://api.github.com/repos/marques-work/gocd/hooks","issue_events_url":"https://api.github.com/repos/marques-work/gocd/issues/events{/number}","events_url":"https://api.github.com/repos/marques-work/gocd/events","assignees_url":"https://api.github.com/repos/marques-work/gocd/assignees{/user}","branches_url":"https://api.github.com/repos/marques-work/gocd/branches{/branch}","tags_url":"https://api.github.com/repos/marques-work/gocd/tags","blobs_url":"https://api.github.com/repos/marques-work/gocd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marques-work/gocd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marques-work/gocd/git/refs{/sha}","trees_url":"https://api.github.com/repos/marques-work/gocd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marques-work/gocd/statuses/{sha}","languages_url":"https://api.github.com/repos/marques-work/gocd/languages","stargazers_url":"https://api.github.com/repos/marques-work/gocd/stargazers","contributors_url":"https://api.github.com/repos/marques-work/gocd/contributors","subscribers_url":"https://api.github.com/repos/marques-work/gocd/subscribers","subscription_url":"https://api.github.com/repos/marques-work/gocd/subscription","commits_url":"https://api.github.com/repos/marques-work/gocd/commits{/sha}","git_commits_url":"https://api.github.com/repos/marques-work/gocd/git/commits{/sha}","comments_url":"https://api.github.com/repos/marques-work/gocd/comments{/number}","issue_comment_url":"https://api.github.com/repos/marques-work/gocd/issues/comments{/number}","contents_url":"https://api.github.com/repos/marques-work/gocd/contents/{+path}","compare_url":"https://api.github.com/repos/marques-work/gocd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marques-work/gocd/merges","archive_url":"https://api.github.com/repos/marques-work/gocd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marques-work/gocd/downloads","issues_url":"https://api.github.com/repos/marques-work/gocd/issues{/number}","pulls_url":"https://api.github.com/repos/marques-work/gocd/pulls{/number}","milestones_url":"https://api.github.com/repos/marques-work/gocd/milestones{/number}","notifications_url":"https://api.github.com/repos/marques-work/gocd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marques-work/gocd/labels{/name}","releases_url":"https://api.github.com/repos/marques-work/gocd/releases{/id}","deployments_url":"https://api.github.com/repos/marques-work/gocd/deployments","created_at":"2017-02-15T17:28:21Z","updated_at":"2017-02-15T17:28:38Z","pushed_at":"2017-04-05T08:53:06Z","git_url":"git://github.com/marques-work/gocd.git","ssh_url":"git@github.com:marques-work/gocd.git","clone_url":"https://github.com/marques-work/gocd.git","svn_url":"https://github.com/marques-work/gocd","homepage":"https://www.gocd.io","size":251270,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"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":"gocd:master","ref":"master","sha":"c8c6d7fb938b84b3f32e9fc9ffaee055fdf499c7","user":{"login":"gocd","id":6099846,"avatar_url":"https://avatars2.githubusercontent.com/u/6099846?v=3","gravatar_id":"","url":"https://api.github.com/users/gocd","html_url":"https://github.com/gocd","followers_url":"https://api.github.com/users/gocd/followers","following_url":"https://api.github.com/users/gocd/following{/other_user}","gists_url":"https://api.github.com/users/gocd/gists{/gist_id}","starred_url":"https://api.github.com/users/gocd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gocd/subscriptions","organizations_url":"https://api.github.com/users/gocd/orgs","repos_url":"https://api.github.com/users/gocd/repos","events_url":"https://api.github.com/users/gocd/events{/privacy}","received_events_url":"https://api.github.com/users/gocd/received_events","type":"Organization","site_admin":false},"repo":{"id":15155534,"name":"gocd","full_name":"gocd/gocd","owner":{"login":"gocd","id":6099846,"avatar_url":"https://avatars2.githubusercontent.com/u/6099846?v=3","gravatar_id":"","url":"https://api.github.com/users/gocd","html_url":"https://github.com/gocd","followers_url":"https://api.github.com/users/gocd/followers","following_url":"https://api.github.com/users/gocd/following{/other_user}","gists_url":"https://api.github.com/users/gocd/gists{/gist_id}","starred_url":"https://api.github.com/users/gocd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gocd/subscriptions","organizations_url":"https://api.github.com/users/gocd/orgs","repos_url":"https://api.github.com/users/gocd/repos","events_url":"https://api.github.com/users/gocd/events{/privacy}","received_events_url":"https://api.github.com/users/gocd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gocd/gocd","description":"Main repository for GoCD - Continuous Delivery server","fork":false,"url":"https://api.github.com/repos/gocd/gocd","forks_url":"https://api.github.com/repos/gocd/gocd/forks","keys_url":"https://api.github.com/repos/gocd/gocd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gocd/gocd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gocd/gocd/teams","hooks_url":"https://api.github.com/repos/gocd/gocd/hooks","issue_events_url":"https://api.github.com/repos/gocd/gocd/issues/events{/number}","events_url":"https://api.github.com/repos/gocd/gocd/events","assignees_url":"https://api.github.com/repos/gocd/gocd/assignees{/user}","branches_url":"https://api.github.com/repos/gocd/gocd/branches{/branch}","tags_url":"https://api.github.com/repos/gocd/gocd/tags","blobs_url":"https://api.github.com/repos/gocd/gocd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gocd/gocd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gocd/gocd/git/refs{/sha}","trees_url":"https://api.github.com/repos/gocd/gocd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gocd/gocd/statuses/{sha}","languages_url":"https://api.github.com/repos/gocd/gocd/languages","stargazers_url":"https://api.github.com/repos/gocd/gocd/stargazers","contributors_url":"https://api.github.com/repos/gocd/gocd/contributors","subscribers_url":"https://api.github.com/repos/gocd/gocd/subscribers","subscription_url":"https://api.github.com/repos/gocd/gocd/subscription","commits_url":"https://api.github.com/repos/gocd/gocd/commits{/sha}","git_commits_url":"https://api.github.com/repos/gocd/gocd/git/commits{/sha}","comments_url":"https://api.github.com/repos/gocd/gocd/comments{/number}","issue_comment_url":"https://api.github.com/repos/gocd/gocd/issues/comments{/number}","contents_url":"https://api.github.com/repos/gocd/gocd/contents/{+path}","compare_url":"https://api.github.com/repos/gocd/gocd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gocd/gocd/merges","archive_url":"https://api.github.com/repos/gocd/gocd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gocd/gocd/downloads","issues_url":"https://api.github.com/repos/gocd/gocd/issues{/number}","pulls_url":"https://api.github.com/repos/gocd/gocd/pulls{/number}","milestones_url":"https://api.github.com/repos/gocd/gocd/milestones{/number}","notifications_url":"https://api.github.com/repos/gocd/gocd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gocd/gocd/labels{/name}","releases_url":"https://api.github.com/repos/gocd/gocd/releases{/id}","deployments_url":"https://api.github.com/repos/gocd/gocd/deployments","created_at":"2013-12-13T05:26:16Z","updated_at":"2017-04-05T09:10:09Z","pushed_at":"2017-04-05T09:32:41Z","git_url":"git://github.com/gocd/gocd.git","ssh_url":"git@github.com:gocd/gocd.git","clone_url":"https://github.com/gocd/gocd.git","svn_url":"https://github.com/gocd/gocd","homepage":"https://www.gocd.io","size":251098,"stargazers_count":3040,"watchers_count":3040,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":569,"mirror_url":null,"open_issues_count":730,"forks":569,"open_issues":730,"watchers":3040,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gocd/gocd/pulls/3360"},"html":{"href":"https://github.com/gocd/gocd/pull/3360"},"issue":{"href":"https://api.github.com/repos/gocd/gocd/issues/3360"},"comments":{"href":"https://api.github.com/repos/gocd/gocd/issues/3360/comments"},"review_comments":{"href":"https://api.github.com/repos/gocd/gocd/pulls/3360/comments"},"review_comment":{"href":"https://api.github.com/repos/gocd/gocd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gocd/gocd/pulls/3360/commits"},"statuses":{"href":"https://api.github.com/repos/gocd/gocd/statuses/8528443b7273a2c05ac2a821e6acaf31c551fed1"}}}}
{"actor":{"display_login":"ketan"}}