payload: {"action":"created","comment":{"url":"https://api.github.com/repos/CSCfi/rems/pulls/comments/351256104","pull_request_review_id":323632116,"id":351256104,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM1MTI1NjEwNA==","diff_hunk":"@@ -5,28 +5,19 @@\n \n (def bot-userid \"approver-bot\")\n \n-(defn- generate-commands [app]\n-  (when (and (application-util/is-handler? app bot-userid)\n-             (= :application.state/submitted (:application/state app))\n-             (empty? (:application/blacklist app)))\n-    [{:type :application.command/approve\n-      :actor bot-userid\n-      :time (time/now)\n-      :application-id (:application/id app)\n-      :comment \"\"}]))\n+(defn- should-approve? [application]\n+  (empty? (:application/blacklist application)))\n \n-(defn- generate-commands-for-application-id [app-id]\n-  (generate-commands (applications/get-unrestricted-application app-id)))\n+(defn- generate-commands [event application]\n+  (when (= :application.event/submitted (:event/type event)) ;; approver bot only reacts to fresh applications\n+    (when (application-util/is-handler? application bot-userid)\n+      (when (should-approve? application)","path":"src/clj/rems/application/approver_bot.clj","position":21,"original_position":21,"commit_id":"e288b3c2e95a93f9172812ece06d25b85304c7c9","original_commit_id":"e288b3c2e95a93f9172812ece06d25b85304c7c9","user":{"login":"luontola","id":42678,"node_id":"MDQ6VXNlcjQyNjc4","avatar_url":"https://avatars0.githubusercontent.com/u/42678?v=4","gravatar_id":"","url":"https://api.github.com/users/luontola","html_url":"https://github.com/luontola","followers_url":"https://api.github.com/users/luontola/followers","following_url":"https://api.github.com/users/luontola/following{/other_user}","gists_url":"https://api.github.com/users/luontola/gists{/gist_id}","starred_url":"https://api.github.com/users/luontola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luontola/subscriptions","organizations_url":"https://api.github.com/users/luontola/orgs","repos_url":"https://api.github.com/users/luontola/repos","events_url":"https://api.github.com/users/luontola/events{/privacy}","received_events_url":"https://api.github.com/users/luontola/received_events","type":"User","site_admin":false},"body":"Would `(when (and` be better than nested `when`s?","created_at":"2019-11-27T12:20:16Z","updated_at":"2019-11-27T12:20:17Z","html_url":"https://github.com/CSCfi/rems/pull/1835#discussion_r351256104","pull_request_url":"https://api.github.com/repos/CSCfi/rems/pulls/1835","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/CSCfi/rems/pulls/comments/351256104"},"html":{"href":"https://github.com/CSCfi/rems/pull/1835#discussion_r351256104"},"pull_request":{"href":"https://api.github.com/repos/CSCfi/rems/pulls/1835"}}},"pull_request":{"url":"https://api.github.com/repos/CSCfi/rems/pulls/1835","id":346198647,"node_id":"MDExOlB1bGxSZXF1ZXN0MzQ2MTk4NjQ3","html_url":"https://github.com/CSCfi/rems/pull/1835","diff_url":"https://github.com/CSCfi/rems/pull/1835.diff","patch_url":"https://github.com/CSCfi/rems/pull/1835.patch","issue_url":"https://api.github.com/repos/CSCfi/rems/issues/1835","number":1835,"state":"open","locked":false,"title":"refactor approver and rejecter bot","user":{"login":"opqdonut","id":207385,"node_id":"MDQ6VXNlcjIwNzM4NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/207385?v=4","gravatar_id":"","url":"https://api.github.com/users/opqdonut","html_url":"https://github.com/opqdonut","followers_url":"https://api.github.com/users/opqdonut/followers","following_url":"https://api.github.com/users/opqdonut/following{/other_user}","gists_url":"https://api.github.com/users/opqdonut/gists{/gist_id}","starred_url":"https://api.github.com/users/opqdonut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opqdonut/subscriptions","organizations_url":"https://api.github.com/users/opqdonut/orgs","repos_url":"https://api.github.com/users/opqdonut/repos","events_url":"https://api.github.com/users/opqdonut/events{/privacy}","received_events_url":"https://api.github.com/users/opqdonut/received_events","type":"User","site_admin":false},"body":"simplify, try to keep domain logic pure","created_at":"2019-11-27T11:46:29Z","updated_at":"2019-11-27T12:20:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac7777f083d564cef529d776f161a68e8e88f930","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/CSCfi/rems/pulls/1835/commits","review_comments_url":"https://api.github.com/repos/CSCfi/rems/pulls/1835/comments","review_comment_url":"https://api.github.com/repos/CSCfi/rems/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CSCfi/rems/issues/1835/comments","statuses_url":"https://api.github.com/repos/CSCfi/rems/statuses/e288b3c2e95a93f9172812ece06d25b85304c7c9","head":{"label":"CSCfi:refactor-approver-bot","ref":"refactor-approver-bot","sha":"e288b3c2e95a93f9172812ece06d25b85304c7c9","user":{"login":"CSCfi","id":5947494,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5NDc0OTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/5947494?v=4","gravatar_id":"","url":"https://api.github.com/users/CSCfi","html_url":"https://github.com/CSCfi","followers_url":"https://api.github.com/users/CSCfi/followers","following_url":"https://api.github.com/users/CSCfi/following{/other_user}","gists_url":"https://api.github.com/users/CSCfi/gists{/gist_id}","starred_url":"https://api.github.com/users/CSCfi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CSCfi/subscriptions","organizations_url":"https://api.github.com/users/CSCfi/orgs","repos_url":"https://api.github.com/users/CSCfi/repos","events_url":"https://api.github.com/users/CSCfi/events{/privacy}","received_events_url":"https://api.github.com/users/CSCfi/received_events","type":"Organization","site_admin":false},"repo":{"id":73476171,"node_id":"MDEwOlJlcG9zaXRvcnk3MzQ3NjE3MQ==","name":"rems","full_name":"CSCfi/rems","private":false,"owner":{"login":"CSCfi","id":5947494,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5NDc0OTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/5947494?v=4","gravatar_id":"","url":"https://api.github.com/users/CSCfi","html_url":"https://github.com/CSCfi","followers_url":"https://api.github.com/users/CSCfi/followers","following_url":"https://api.github.com/users/CSCfi/following{/other_user}","gists_url":"https://api.github.com/users/CSCfi/gists{/gist_id}","starred_url":"https://api.github.com/users/CSCfi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CSCfi/subscriptions","organizations_url":"https://api.github.com/users/CSCfi/orgs","repos_url":"https://api.github.com/users/CSCfi/repos","events_url":"https://api.github.com/users/CSCfi/events{/privacy}","received_events_url":"https://api.github.com/users/CSCfi/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/CSCfi/rems","description":"Resource Entitlement Management System is a tool for managing access rights to resources, such as research datasets.","fork":false,"url":"https://api.github.com/repos/CSCfi/rems","forks_url":"https://api.github.com/repos/CSCfi/rems/forks","keys_url":"https://api.github.com/repos/CSCfi/rems/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CSCfi/rems/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CSCfi/rems/teams","hooks_url":"https://api.github.com/repos/CSCfi/rems/hooks","issue_events_url":"https://api.github.com/repos/CSCfi/rems/issues/events{/number}","events_url":"https://api.github.com/repos/CSCfi/rems/events","assignees_url":"https://api.github.com/repos/CSCfi/rems/assignees{/user}","branches_url":"https://api.github.com/repos/CSCfi/rems/branches{/branch}","tags_url":"https://api.github.com/repos/CSCfi/rems/tags","blobs_url":"https://api.github.com/repos/CSCfi/rems/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CSCfi/rems/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CSCfi/rems/git/refs{/sha}","trees_url":"https://api.github.com/repos/CSCfi/rems/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CSCfi/rems/statuses/{sha}","languages_url":"https://api.github.com/repos/CSCfi/rems/languages","stargazers_url":"https://api.github.com/repos/CSCfi/rems/stargazers","contributors_url":"https://api.github.com/repos/CSCfi/rems/contributors","subscribers_url":"https://api.github.com/repos/CSCfi/rems/subscribers","subscription_url":"https://api.github.com/repos/CSCfi/rems/subscription","commits_url":"https://api.github.com/repos/CSCfi/rems/commits{/sha}","git_commits_url":"https://api.github.com/repos/CSCfi/rems/git/commits{/sha}","comments_url":"https://api.github.com/repos/CSCfi/rems/comments{/number}","issue_comment_url":"https://api.github.com/repos/CSCfi/rems/issues/comments{/number}","contents_url":"https://api.github.com/repos/CSCfi/rems/contents/{+path}","compare_url":"https://api.github.com/repos/CSCfi/rems/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CSCfi/rems/merges","archive_url":"https://api.github.com/repos/CSCfi/rems/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CSCfi/rems/downloads","issues_url":"https://api.github.com/repos/CSCfi/rems/issues{/number}","pulls_url":"https://api.github.com/repos/CSCfi/rems/pulls{/number}","milestones_url":"https://api.github.com/repos/CSCfi/rems/milestones{/number}","notifications_url":"https://api.github.com/repos/CSCfi/rems/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CSCfi/rems/labels{/name}","releases_url":"https://api.github.com/repos/CSCfi/rems/releases{/id}","deployments_url":"https://api.github.com/repos/CSCfi/rems/deployments","created_at":"2016-11-11T12:31:56Z","updated_at":"2019-11-27T10:10:32Z","pushed_at":"2019-11-27T11:46:30Z","git_url":"git://github.com/CSCfi/rems.git","ssh_url":"git@github.com:CSCfi/rems.git","clone_url":"https://github.com/CSCfi/rems.git","svn_url":"https://github.com/CSCfi/rems","homepage":"","size":15189,"stargazers_count":6,"watchers_count":6,"language":"Clojure","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":86,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":6,"open_issues":86,"watchers":6,"default_branch":"master"}},"base":{"label":"CSCfi:master","ref":"master","sha":"4d3eaa3abce1098011f504454b3dbe8303783eb6","user":{"login":"CSCfi","id":5947494,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5NDc0OTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/5947494?v=4","gravatar_id":"","url":"https://api.github.com/users/CSCfi","html_url":"https://github.com/CSCfi","followers_url":"https://api.github.com/users/CSCfi/followers","following_url":"https://api.github.com/users/CSCfi/following{/other_user}","gists_url":"https://api.github.com/users/CSCfi/gists{/gist_id}","starred_url":"https://api.github.com/users/CSCfi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CSCfi/subscriptions","organizations_url":"https://api.github.com/users/CSCfi/orgs","repos_url":"https://api.github.com/users/CSCfi/repos","events_url":"https://api.github.com/users/CSCfi/events{/privacy}","received_events_url":"https://api.github.com/users/CSCfi/received_events","type":"Organization","site_admin":false},"repo":{"id":73476171,"node_id":"MDEwOlJlcG9zaXRvcnk3MzQ3NjE3MQ==","name":"rems","full_name":"CSCfi/rems","private":false,"owner":{"login":"CSCfi","id":5947494,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5NDc0OTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/5947494?v=4","gravatar_id":"","url":"https://api.github.com/users/CSCfi","html_url":"https://github.com/CSCfi","followers_url":"https://api.github.com/users/CSCfi/followers","following_url":"https://api.github.com/users/CSCfi/following{/other_user}","gists_url":"https://api.github.com/users/CSCfi/gists{/gist_id}","starred_url":"https://api.github.com/users/CSCfi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CSCfi/subscriptions","organizations_url":"https://api.github.com/users/CSCfi/orgs","repos_url":"https://api.github.com/users/CSCfi/repos","events_url":"https://api.github.com/users/CSCfi/events{/privacy}","received_events_url":"https://api.github.com/users/CSCfi/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/CSCfi/rems","description":"Resource Entitlement Management System is a tool for managing access rights to resources, such as research datasets.","fork":false,"url":"https://api.github.com/repos/CSCfi/rems","forks_url":"https://api.github.com/repos/CSCfi/rems/forks","keys_url":"https://api.github.com/repos/CSCfi/rems/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CSCfi/rems/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CSCfi/rems/teams","hooks_url":"https://api.github.com/repos/CSCfi/rems/hooks","issue_events_url":"https://api.github.com/repos/CSCfi/rems/issues/events{/number}","events_url":"https://api.github.com/repos/CSCfi/rems/events","assignees_url":"https://api.github.com/repos/CSCfi/rems/assignees{/user}","branches_url":"https://api.github.com/repos/CSCfi/rems/branches{/branch}","tags_url":"https://api.github.com/repos/CSCfi/rems/tags","blobs_url":"https://api.github.com/repos/CSCfi/rems/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CSCfi/rems/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CSCfi/rems/git/refs{/sha}","trees_url":"https://api.github.com/repos/CSCfi/rems/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CSCfi/rems/statuses/{sha}","languages_url":"https://api.github.com/repos/CSCfi/rems/languages","stargazers_url":"https://api.github.com/repos/CSCfi/rems/stargazers","contributors_url":"https://api.github.com/repos/CSCfi/rems/contributors","subscribers_url":"https://api.github.com/repos/CSCfi/rems/subscribers","subscription_url":"https://api.github.com/repos/CSCfi/rems/subscription","commits_url":"https://api.github.com/repos/CSCfi/rems/commits{/sha}","git_commits_url":"https://api.github.com/repos/CSCfi/rems/git/commits{/sha}","comments_url":"https://api.github.com/repos/CSCfi/rems/comments{/number}","issue_comment_url":"https://api.github.com/repos/CSCfi/rems/issues/comments{/number}","contents_url":"https://api.github.com/repos/CSCfi/rems/contents/{+path}","compare_url":"https://api.github.com/repos/CSCfi/rems/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CSCfi/rems/merges","archive_url":"https://api.github.com/repos/CSCfi/rems/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CSCfi/rems/downloads","issues_url":"https://api.github.com/repos/CSCfi/rems/issues{/number}","pulls_url":"https://api.github.com/repos/CSCfi/rems/pulls{/number}","milestones_url":"https://api.github.com/repos/CSCfi/rems/milestones{/number}","notifications_url":"https://api.github.com/repos/CSCfi/rems/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CSCfi/rems/labels{/name}","releases_url":"https://api.github.com/repos/CSCfi/rems/releases{/id}","deployments_url":"https://api.github.com/repos/CSCfi/rems/deployments","created_at":"2016-11-11T12:31:56Z","updated_at":"2019-11-27T10:10:32Z","pushed_at":"2019-11-27T11:46:30Z","git_url":"git://github.com/CSCfi/rems.git","ssh_url":"git@github.com:CSCfi/rems.git","clone_url":"https://github.com/CSCfi/rems.git","svn_url":"https://github.com/CSCfi/rems","homepage":"","size":15189,"stargazers_count":6,"watchers_count":6,"language":"Clojure","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":86,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":6,"open_issues":86,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CSCfi/rems/pulls/1835"},"html":{"href":"https://github.com/CSCfi/rems/pull/1835"},"issue":{"href":"https://api.github.com/repos/CSCfi/rems/issues/1835"},"comments":{"href":"https://api.github.com/repos/CSCfi/rems/issues/1835/comments"},"review_comments":{"href":"https://api.github.com/repos/CSCfi/rems/pulls/1835/comments"},"review_comment":{"href":"https://api.github.com/repos/CSCfi/rems/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CSCfi/rems/pulls/1835/commits"},"statuses":{"href":"https://api.github.com/repos/CSCfi/rems/statuses/e288b3c2e95a93f9172812ece06d25b85304c7c9"}},"author_association":"COLLABORATOR"}}
other: {"actor":{"display_login":"luontola"}}