{"action":"created","comment":{"url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/comments/78318803","id":78318803,"diff_hunk":"@@ -20,6 +20,49 @@ schema.methods.getGroups = function getUserGroups () {\n   return userGroups;\n };\n \n+// Get an array of error message keys that would be thrown if the given interaction was attempted\n+schema.methods.getObjectionsToInteractionIfAny = function getObjectionsToInteractionIfAny (interaction, receiver) {\n+  let sender = this;\n+\n+  /* eslint-disable no-unused-vars */","path":"website/server/models/user/methods.js","position":null,"original_position":8,"commit_id":"47761655804d49574b0a6c8455b7b459a88c6477","original_commit_id":"4aaeb2180d05d2f2686c654f554073c9c0ff4208","user":{"login":"CrystallineCat","id":5156808,"avatar_url":"https://avatars.githubusercontent.com/u/5156808?v=3","gravatar_id":"","url":"https://api.github.com/users/CrystallineCat","html_url":"https://github.com/CrystallineCat","followers_url":"https://api.github.com/users/CrystallineCat/followers","following_url":"https://api.github.com/users/CrystallineCat/following{/other_user}","gists_url":"https://api.github.com/users/CrystallineCat/gists{/gist_id}","starred_url":"https://api.github.com/users/CrystallineCat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrystallineCat/subscriptions","organizations_url":"https://api.github.com/users/CrystallineCat/orgs","repos_url":"https://api.github.com/users/CrystallineCat/repos","events_url":"https://api.github.com/users/CrystallineCat/events{/privacy}","received_events_url":"https://api.github.com/users/CrystallineCat/received_events","type":"User","site_admin":false},"body":"The checks are all of the form `(sndr, rcvr) => ...`, due to being iterated over and called with the same signature, but not all of them use both parameters. This leads to spurious `no-unused-vars` issues.\r\n\r\nI think following the linter here would be wrong and make the code worse, not better. I've added a comment stating the reason for the disable.","created_at":"2016-09-12T06:09:52Z","updated_at":"2016-09-12T06:09:52Z","html_url":"https://github.com/HabitRPG/habitrpg/pull/7997#discussion_r78318803","pull_request_url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7997","_links":{"self":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/comments/78318803"},"html":{"href":"https://github.com/HabitRPG/habitrpg/pull/7997#discussion_r78318803"},"pull_request":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7997"}}},"pull_request":{"url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7997","id":84799389,"html_url":"https://github.com/HabitRPG/habitrpg/pull/7997","diff_url":"https://github.com/HabitRPG/habitrpg/pull/7997.diff","patch_url":"https://github.com/HabitRPG/habitrpg/pull/7997.patch","issue_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7997","number":7997,"state":"open","locked":false,"title":"Disallow interactions by blocked users; some interaction API refactoring (fixes #7971)","user":{"login":"CrystallineCat","id":5156808,"avatar_url":"https://avatars.githubusercontent.com/u/5156808?v=3","gravatar_id":"","url":"https://api.github.com/users/CrystallineCat","html_url":"https://github.com/CrystallineCat","followers_url":"https://api.github.com/users/CrystallineCat/followers","following_url":"https://api.github.com/users/CrystallineCat/following{/other_user}","gists_url":"https://api.github.com/users/CrystallineCat/gists{/gist_id}","starred_url":"https://api.github.com/users/CrystallineCat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrystallineCat/subscriptions","organizations_url":"https://api.github.com/users/CrystallineCat/orgs","repos_url":"https://api.github.com/users/CrystallineCat/repos","events_url":"https://api.github.com/users/CrystallineCat/events{/privacy}","received_events_url":"https://api.github.com/users/CrystallineCat/received_events","type":"User","site_admin":false},"body":"Fixes #7971\r\n\r\nThis PR changes the way objections to user-to-user interactions are handled (e.g. chat revocation or blocks). It includes some refactoring to the API to make it more flexible and allows the UI to query the estimated success of interactions. No UI changes are done at this time.\r\n\r\nAPI refactoring:\r\n- Factors out the checks in `api.sendPrivateMessage` and `api.transferGems` to see if the interaction is allowed.\r\n- The checks are now in `User.getObjectionsToInteractionIfAny`; the method is designed to be easily extensible to new checks or new interactions.\r\n- To allow the UI to check whether an interaction is allowed without actually preforming it, there is a new function `api.getObjectionsToInteractionIfAny`; it only applies interactions initiated by the logged in user and can not be used to query interactions by other users.\r\n- All objections to an interaction now use NotAuthorized instead of NotFound.\r\n- All objection strings are now translatable.\r\n\r\nAdditional checks:\r\n- Both `api.sendPrivateMessage` and `api.transferGems` now are now blocked by `sender.flags.chatRevoked`.\r\n- `api.transferGems` is now blocked by either user blocking the other.\r\n\r\nTests:\r\n- Tests for the additional checks and the new API have been added.\r\n\r\n----\r\nUUID: fea892e5-ac99-4b03-83ac-d01a2154e2af\r\n","created_at":"2016-09-11T21:57:35Z","updated_at":"2016-09-12T06:09:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7997/commits","review_comments_url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7997/comments","review_comment_url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7997/comments","statuses_url":"https://api.github.com/repos/HabitRPG/habitrpg/statuses/47761655804d49574b0a6c8455b7b459a88c6477","head":{"label":"CrystallineCat:develop","ref":"develop","sha":"47761655804d49574b0a6c8455b7b459a88c6477","user":{"login":"CrystallineCat","id":5156808,"avatar_url":"https://avatars.githubusercontent.com/u/5156808?v=3","gravatar_id":"","url":"https://api.github.com/users/CrystallineCat","html_url":"https://github.com/CrystallineCat","followers_url":"https://api.github.com/users/CrystallineCat/followers","following_url":"https://api.github.com/users/CrystallineCat/following{/other_user}","gists_url":"https://api.github.com/users/CrystallineCat/gists{/gist_id}","starred_url":"https://api.github.com/users/CrystallineCat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrystallineCat/subscriptions","organizations_url":"https://api.github.com/users/CrystallineCat/orgs","repos_url":"https://api.github.com/users/CrystallineCat/repos","events_url":"https://api.github.com/users/CrystallineCat/events{/privacy}","received_events_url":"https://api.github.com/users/CrystallineCat/received_events","type":"User","site_admin":false},"repo":{"id":67504090,"name":"habitrpg","full_name":"CrystallineCat/habitrpg","owner":{"login":"CrystallineCat","id":5156808,"avatar_url":"https://avatars.githubusercontent.com/u/5156808?v=3","gravatar_id":"","url":"https://api.github.com/users/CrystallineCat","html_url":"https://github.com/CrystallineCat","followers_url":"https://api.github.com/users/CrystallineCat/followers","following_url":"https://api.github.com/users/CrystallineCat/following{/other_user}","gists_url":"https://api.github.com/users/CrystallineCat/gists{/gist_id}","starred_url":"https://api.github.com/users/CrystallineCat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrystallineCat/subscriptions","organizations_url":"https://api.github.com/users/CrystallineCat/orgs","repos_url":"https://api.github.com/users/CrystallineCat/repos","events_url":"https://api.github.com/users/CrystallineCat/events{/privacy}","received_events_url":"https://api.github.com/users/CrystallineCat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CrystallineCat/habitrpg","description":"A habit tracker app which treats your goals like a Role Playing Game.","fork":true,"url":"https://api.github.com/repos/CrystallineCat/habitrpg","forks_url":"https://api.github.com/repos/CrystallineCat/habitrpg/forks","keys_url":"https://api.github.com/repos/CrystallineCat/habitrpg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CrystallineCat/habitrpg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CrystallineCat/habitrpg/teams","hooks_url":"https://api.github.com/repos/CrystallineCat/habitrpg/hooks","issue_events_url":"https://api.github.com/repos/CrystallineCat/habitrpg/issues/events{/number}","events_url":"https://api.github.com/repos/CrystallineCat/habitrpg/events","assignees_url":"https://api.github.com/repos/CrystallineCat/habitrpg/assignees{/user}","branches_url":"https://api.github.com/repos/CrystallineCat/habitrpg/branches{/branch}","tags_url":"https://api.github.com/repos/CrystallineCat/habitrpg/tags","blobs_url":"https://api.github.com/repos/CrystallineCat/habitrpg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CrystallineCat/habitrpg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CrystallineCat/habitrpg/git/refs{/sha}","trees_url":"https://api.github.com/repos/CrystallineCat/habitrpg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CrystallineCat/habitrpg/statuses/{sha}","languages_url":"https://api.github.com/repos/CrystallineCat/habitrpg/languages","stargazers_url":"https://api.github.com/repos/CrystallineCat/habitrpg/stargazers","contributors_url":"https://api.github.com/repos/CrystallineCat/habitrpg/contributors","subscribers_url":"https://api.github.com/repos/CrystallineCat/habitrpg/subscribers","subscription_url":"https://api.github.com/repos/CrystallineCat/habitrpg/subscription","commits_url":"https://api.github.com/repos/CrystallineCat/habitrpg/commits{/sha}","git_commits_url":"https://api.github.com/repos/CrystallineCat/habitrpg/git/commits{/sha}","comments_url":"https://api.github.com/repos/CrystallineCat/habitrpg/comments{/number}","issue_comment_url":"https://api.github.com/repos/CrystallineCat/habitrpg/issues/comments{/number}","contents_url":"https://api.github.com/repos/CrystallineCat/habitrpg/contents/{+path}","compare_url":"https://api.github.com/repos/CrystallineCat/habitrpg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CrystallineCat/habitrpg/merges","archive_url":"https://api.github.com/repos/CrystallineCat/habitrpg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CrystallineCat/habitrpg/downloads","issues_url":"https://api.github.com/repos/CrystallineCat/habitrpg/issues{/number}","pulls_url":"https://api.github.com/repos/CrystallineCat/habitrpg/pulls{/number}","milestones_url":"https://api.github.com/repos/CrystallineCat/habitrpg/milestones{/number}","notifications_url":"https://api.github.com/repos/CrystallineCat/habitrpg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CrystallineCat/habitrpg/labels{/name}","releases_url":"https://api.github.com/repos/CrystallineCat/habitrpg/releases{/id}","deployments_url":"https://api.github.com/repos/CrystallineCat/habitrpg/deployments","created_at":"2016-09-06T12:00:43Z","updated_at":"2016-09-06T12:00:53Z","pushed_at":"2016-09-12T05:51:43Z","git_url":"git://github.com/CrystallineCat/habitrpg.git","ssh_url":"git@github.com:CrystallineCat/habitrpg.git","clone_url":"https://github.com/CrystallineCat/habitrpg.git","svn_url":"https://github.com/CrystallineCat/habitrpg","homepage":"https://habitica.com","size":428087,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"develop"}},"base":{"label":"HabitRPG:develop","ref":"develop","sha":"0474b5d2e6661b2d10acfc0eee170be41bf93bca","user":{"login":"HabitRPG","id":3834775,"avatar_url":"https://avatars.githubusercontent.com/u/3834775?v=3","gravatar_id":"","url":"https://api.github.com/users/HabitRPG","html_url":"https://github.com/HabitRPG","followers_url":"https://api.github.com/users/HabitRPG/followers","following_url":"https://api.github.com/users/HabitRPG/following{/other_user}","gists_url":"https://api.github.com/users/HabitRPG/gists{/gist_id}","starred_url":"https://api.github.com/users/HabitRPG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HabitRPG/subscriptions","organizations_url":"https://api.github.com/users/HabitRPG/orgs","repos_url":"https://api.github.com/users/HabitRPG/repos","events_url":"https://api.github.com/users/HabitRPG/events{/privacy}","received_events_url":"https://api.github.com/users/HabitRPG/received_events","type":"Organization","site_admin":false},"repo":{"id":4578898,"name":"habitrpg","full_name":"HabitRPG/habitrpg","owner":{"login":"HabitRPG","id":3834775,"avatar_url":"https://avatars.githubusercontent.com/u/3834775?v=3","gravatar_id":"","url":"https://api.github.com/users/HabitRPG","html_url":"https://github.com/HabitRPG","followers_url":"https://api.github.com/users/HabitRPG/followers","following_url":"https://api.github.com/users/HabitRPG/following{/other_user}","gists_url":"https://api.github.com/users/HabitRPG/gists{/gist_id}","starred_url":"https://api.github.com/users/HabitRPG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HabitRPG/subscriptions","organizations_url":"https://api.github.com/users/HabitRPG/orgs","repos_url":"https://api.github.com/users/HabitRPG/repos","events_url":"https://api.github.com/users/HabitRPG/events{/privacy}","received_events_url":"https://api.github.com/users/HabitRPG/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HabitRPG/habitrpg","description":"A habit tracker app which treats your goals like a Role Playing Game.","fork":false,"url":"https://api.github.com/repos/HabitRPG/habitrpg","forks_url":"https://api.github.com/repos/HabitRPG/habitrpg/forks","keys_url":"https://api.github.com/repos/HabitRPG/habitrpg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HabitRPG/habitrpg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HabitRPG/habitrpg/teams","hooks_url":"https://api.github.com/repos/HabitRPG/habitrpg/hooks","issue_events_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/events{/number}","events_url":"https://api.github.com/repos/HabitRPG/habitrpg/events","assignees_url":"https://api.github.com/repos/HabitRPG/habitrpg/assignees{/user}","branches_url":"https://api.github.com/repos/HabitRPG/habitrpg/branches{/branch}","tags_url":"https://api.github.com/repos/HabitRPG/habitrpg/tags","blobs_url":"https://api.github.com/repos/HabitRPG/habitrpg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HabitRPG/habitrpg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HabitRPG/habitrpg/git/refs{/sha}","trees_url":"https://api.github.com/repos/HabitRPG/habitrpg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HabitRPG/habitrpg/statuses/{sha}","languages_url":"https://api.github.com/repos/HabitRPG/habitrpg/languages","stargazers_url":"https://api.github.com/repos/HabitRPG/habitrpg/stargazers","contributors_url":"https://api.github.com/repos/HabitRPG/habitrpg/contributors","subscribers_url":"https://api.github.com/repos/HabitRPG/habitrpg/subscribers","subscription_url":"https://api.github.com/repos/HabitRPG/habitrpg/subscription","commits_url":"https://api.github.com/repos/HabitRPG/habitrpg/commits{/sha}","git_commits_url":"https://api.github.com/repos/HabitRPG/habitrpg/git/commits{/sha}","comments_url":"https://api.github.com/repos/HabitRPG/habitrpg/comments{/number}","issue_comment_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues/comments{/number}","contents_url":"https://api.github.com/repos/HabitRPG/habitrpg/contents/{+path}","compare_url":"https://api.github.com/repos/HabitRPG/habitrpg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HabitRPG/habitrpg/merges","archive_url":"https://api.github.com/repos/HabitRPG/habitrpg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HabitRPG/habitrpg/downloads","issues_url":"https://api.github.com/repos/HabitRPG/habitrpg/issues{/number}","pulls_url":"https://api.github.com/repos/HabitRPG/habitrpg/pulls{/number}","milestones_url":"https://api.github.com/repos/HabitRPG/habitrpg/milestones{/number}","notifications_url":"https://api.github.com/repos/HabitRPG/habitrpg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HabitRPG/habitrpg/labels{/name}","releases_url":"https://api.github.com/repos/HabitRPG/habitrpg/releases{/id}","deployments_url":"https://api.github.com/repos/HabitRPG/habitrpg/deployments","created_at":"2012-06-06T22:49:48Z","updated_at":"2016-09-11T23:29:26Z","pushed_at":"2016-09-12T05:51:45Z","git_url":"git://github.com/HabitRPG/habitrpg.git","ssh_url":"git@github.com:HabitRPG/habitrpg.git","clone_url":"https://github.com/HabitRPG/habitrpg.git","svn_url":"https://github.com/HabitRPG/habitrpg","homepage":"https://habitica.com","size":516775,"stargazers_count":4166,"watchers_count":4166,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1744,"mirror_url":null,"open_issues_count":348,"forks":1744,"open_issues":348,"watchers":4166,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7997"},"html":{"href":"https://github.com/HabitRPG/habitrpg/pull/7997"},"issue":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7997"},"comments":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/issues/7997/comments"},"review_comments":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7997/comments"},"review_comment":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/pulls/7997/commits"},"statuses":{"href":"https://api.github.com/repos/HabitRPG/habitrpg/statuses/47761655804d49574b0a6c8455b7b459a88c6477"}}}}
{"actor":{"display_login":"CrystallineCat"}}