{"action":"created","comment":{"url":"https://api.github.com/repos/thorncp/ReviewSite/pulls/comments/22501708","id":22501708,"diff_hunk":"@@ -11,90 +11,82 @@ def initialize(user)\n       # baseline\n       can :manage, SelfAssessment do | self_assessment |\n         self_assessment.review.upcoming? &&\n-          own_review?(self_assessment.review, user)\n+        own_review?(self_assessment.review, user)\n       end\n \n       can :manage, Invitation do | invitation |\n         invitation.review.upcoming? &&\n-          (own_review?(invitation.review, user) ||\n-          coachee_review?(invitation.review, user))\n+        (own_review?(invitation.review, user) ||\n+        coachee_review?(invitation.review, user))\n       end\n+\n       can [:read, :destroy],\n-          Invitation,\n-          email: user.email\n+      Invitation,\n+      email: user.email\n \n       can [:read, :update, :destroy],\n-          Feedback,\n-          submitted: false, user_id: user.id\n+      Feedback,\n+      submitted: false, user_id: user.id\n+\n       can [:create, :new], Feedback do | feedback |\n         feedback.review.upcoming? && (\n-          !feedback.review.invitations.where(email: user.email).empty? ||\n-          own_review?(feedback.review, user)\n+        !feedback.review.invitations.where(email: user.email).empty? ||\n+        own_review?(feedback.review, user)\n         )\n       end\n-      can :send_reminder, Feedback, review: { associate_consultant:\n-        { user_id: user.id } }\n-      can :send_reminder, Feedback, review: { associate_consultant:\n-        { coach_id: user.id } }\n-      # only admins can use \"submit\"/\"unsubmit\" functions in controller\n-      cannot :submit, Feedback\n-      cannot :unsubmit, Feedback\n-      can :read, Feedback, submitted: true, user_id: user.id\n-      can :read,\n-          Feedback,\n-          submitted: true,\n-          review: { associate_consultant: { user_id: user.id } }\n-      can :read,\n-          Feedback,\n-          submitted: true,\n-          review: { associate_consultant: { coach_id: user.id } }\n-      can :read,\n-          Feedback,\n-          submitted: true,\n-          review: {\n-            associate_consultant: {\n-              reviewing_group_id: user.reviewing_group_ids\n-            }\n-          }\n-\n-      can [:summary, :index, :read],\n-          Review,\n-          associate_consultant: { user_id: user.id }\n-      can [:summary, :index, :read],\n-          Review,\n-          associate_consultant: { coach_id: user.id }\n-      can [:summary, :index, :read],\n-          Review,\n-          associate_consultant: { reviewing_group_id: user.reviewing_group_ids }\n-\n-      can [:update, :feedbacks, :completed_feedback], User, id: user.id\n-\n-      # admin permissions\n-      if user.admin\n-        can :manage, Review\n-        can :manage, ReviewingGroup\n-        can :manage, AssociateConsultant\n-        can :manage, User\n-        can :manage, Invitation\n-        can [:summary, :index, :read], Feedback, submitted: true\n-        can :send_reminder, Feedback, submitted: false\n-        can :submit, Feedback do |feedback|\n-          !feedback.submitted\n-        end\n-        can :unsubmit, Feedback do |feedback|\n-          feedback.submitted\n+\n+      can :manage, AdditionalEmail\n+\n+      can [:create, :new], Feedback do |feedback |\n+        review = feedback.review\n+        !review.invitations.where(email: user.email).empty? || (review.associate_consultant.user.id == user.id) ||\n+        !review.invitations.where(user.additional_emails.includes(:email)).empty?\n+      end\n+\n+\n+      can :send_reminder, Feedback, :review => { :associate_consultant =>\n+        { :user_id => user.id } }\n+        can :send_reminder, Feedback, :review => { :associate_consultant =>\n+          { :coach_id => user.id } }\n+          cannot :submit, Feedback # only admins can use \"submit\"/\"unsubmit\" functions in controller\n+          cannot :unsubmit, Feedback\n+          can :read, Feedback, { :submitted => true, :user_id => user.id }\n+          can :read, Feedback, { :submitted => true, :review => { :associate_consultant => { :user_id => user.id } } }\n+          can :read, Feedback, { :submitted => true, :review => { :associate_consultant => { :coach_id => user.id } } }\n+          can :read, Feedback, { :submitted => true, :review => { :associate_consultant => { :reviewing_group_id => user.reviewing_group_ids } } }\n+\n+          can [:summary, :index, :read], Review, :associate_consultant => { :user_id => user.id }","path":"app/models/ability.rb","position":108,"original_position":108,"commit_id":"de255ff8967687e0b5041dc5b839349295d1597d","original_commit_id":"de255ff8967687e0b5041dc5b839349295d1597d","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Line is too long. [97/80]<br>Use the new Ruby 1.9 hash syntax.<br>Inconsistent indentation detected.","created_at":"2015-01-06T00:49:31Z","updated_at":"2015-01-06T00:49:31Z","html_url":"https://github.com/thorncp/ReviewSite/pull/8#discussion_r22501708","pull_request_url":"https://api.github.com/repos/thorncp/ReviewSite/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/thorncp/ReviewSite/pulls/comments/22501708"},"html":{"href":"https://github.com/thorncp/ReviewSite/pull/8#discussion_r22501708"},"pull_request":{"href":"https://api.github.com/repos/thorncp/ReviewSite/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/thorncp/ReviewSite/pulls/8","id":26862790,"html_url":"https://github.com/thorncp/ReviewSite/pull/8","diff_url":"https://github.com/thorncp/ReviewSite/pull/8.diff","patch_url":"https://github.com/thorncp/ReviewSite/pull/8.patch","issue_url":"https://api.github.com/repos/thorncp/ReviewSite/issues/8","number":8,"state":"open","locked":false,"title":"Another branch","user":{"login":"thorncp","id":72176,"avatar_url":"https://avatars.githubusercontent.com/u/72176?v=3","gravatar_id":"","url":"https://api.github.com/users/thorncp","html_url":"https://github.com/thorncp","followers_url":"https://api.github.com/users/thorncp/followers","following_url":"https://api.github.com/users/thorncp/following{/other_user}","gists_url":"https://api.github.com/users/thorncp/gists{/gist_id}","starred_url":"https://api.github.com/users/thorncp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thorncp/subscriptions","organizations_url":"https://api.github.com/users/thorncp/orgs","repos_url":"https://api.github.com/users/thorncp/repos","events_url":"https://api.github.com/users/thorncp/events{/privacy}","received_events_url":"https://api.github.com/users/thorncp/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-06T00:49:14Z","updated_at":"2015-01-06T00:49:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d6a87c3bd3d1788c849da2703a65f9124a761d60","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/thorncp/ReviewSite/pulls/8/commits","review_comments_url":"https://api.github.com/repos/thorncp/ReviewSite/pulls/8/comments","review_comment_url":"https://api.github.com/repos/thorncp/ReviewSite/pulls/comments/{number}","comments_url":"https://api.github.com/repos/thorncp/ReviewSite/issues/8/comments","statuses_url":"https://api.github.com/repos/thorncp/ReviewSite/statuses/de255ff8967687e0b5041dc5b839349295d1597d","head":{"label":"thorncp:another-branch","ref":"another-branch","sha":"de255ff8967687e0b5041dc5b839349295d1597d","user":{"login":"thorncp","id":72176,"avatar_url":"https://avatars.githubusercontent.com/u/72176?v=3","gravatar_id":"","url":"https://api.github.com/users/thorncp","html_url":"https://github.com/thorncp","followers_url":"https://api.github.com/users/thorncp/followers","following_url":"https://api.github.com/users/thorncp/following{/other_user}","gists_url":"https://api.github.com/users/thorncp/gists{/gist_id}","starred_url":"https://api.github.com/users/thorncp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thorncp/subscriptions","organizations_url":"https://api.github.com/users/thorncp/orgs","repos_url":"https://api.github.com/users/thorncp/repos","events_url":"https://api.github.com/users/thorncp/events{/privacy}","received_events_url":"https://api.github.com/users/thorncp/received_events","type":"User","site_admin":false},"repo":{"id":28833458,"name":"ReviewSite","full_name":"thorncp/ReviewSite","owner":{"login":"thorncp","id":72176,"avatar_url":"https://avatars.githubusercontent.com/u/72176?v=3","gravatar_id":"","url":"https://api.github.com/users/thorncp","html_url":"https://github.com/thorncp","followers_url":"https://api.github.com/users/thorncp/followers","following_url":"https://api.github.com/users/thorncp/following{/other_user}","gists_url":"https://api.github.com/users/thorncp/gists{/gist_id}","starred_url":"https://api.github.com/users/thorncp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thorncp/subscriptions","organizations_url":"https://api.github.com/users/thorncp/orgs","repos_url":"https://api.github.com/users/thorncp/repos","events_url":"https://api.github.com/users/thorncp/events{/privacy}","received_events_url":"https://api.github.com/users/thorncp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thorncp/ReviewSite","description":"","fork":false,"url":"https://api.github.com/repos/thorncp/ReviewSite","forks_url":"https://api.github.com/repos/thorncp/ReviewSite/forks","keys_url":"https://api.github.com/repos/thorncp/ReviewSite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thorncp/ReviewSite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thorncp/ReviewSite/teams","hooks_url":"https://api.github.com/repos/thorncp/ReviewSite/hooks","issue_events_url":"https://api.github.com/repos/thorncp/ReviewSite/issues/events{/number}","events_url":"https://api.github.com/repos/thorncp/ReviewSite/events","assignees_url":"https://api.github.com/repos/thorncp/ReviewSite/assignees{/user}","branches_url":"https://api.github.com/repos/thorncp/ReviewSite/branches{/branch}","tags_url":"https://api.github.com/repos/thorncp/ReviewSite/tags","blobs_url":"https://api.github.com/repos/thorncp/ReviewSite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thorncp/ReviewSite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thorncp/ReviewSite/git/refs{/sha}","trees_url":"https://api.github.com/repos/thorncp/ReviewSite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thorncp/ReviewSite/statuses/{sha}","languages_url":"https://api.github.com/repos/thorncp/ReviewSite/languages","stargazers_url":"https://api.github.com/repos/thorncp/ReviewSite/stargazers","contributors_url":"https://api.github.com/repos/thorncp/ReviewSite/contributors","subscribers_url":"https://api.github.com/repos/thorncp/ReviewSite/subscribers","subscription_url":"https://api.github.com/repos/thorncp/ReviewSite/subscription","commits_url":"https://api.github.com/repos/thorncp/ReviewSite/commits{/sha}","git_commits_url":"https://api.github.com/repos/thorncp/ReviewSite/git/commits{/sha}","comments_url":"https://api.github.com/repos/thorncp/ReviewSite/comments{/number}","issue_comment_url":"https://api.github.com/repos/thorncp/ReviewSite/issues/comments/{number}","contents_url":"https://api.github.com/repos/thorncp/ReviewSite/contents/{+path}","compare_url":"https://api.github.com/repos/thorncp/ReviewSite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thorncp/ReviewSite/merges","archive_url":"https://api.github.com/repos/thorncp/ReviewSite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thorncp/ReviewSite/downloads","issues_url":"https://api.github.com/repos/thorncp/ReviewSite/issues{/number}","pulls_url":"https://api.github.com/repos/thorncp/ReviewSite/pulls{/number}","milestones_url":"https://api.github.com/repos/thorncp/ReviewSite/milestones{/number}","notifications_url":"https://api.github.com/repos/thorncp/ReviewSite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thorncp/ReviewSite/labels{/name}","releases_url":"https://api.github.com/repos/thorncp/ReviewSite/releases{/id}","created_at":"2015-01-05T21:49:16Z","updated_at":"2015-01-05T21:49:26Z","pushed_at":"2015-01-06T00:21:03Z","git_url":"git://github.com/thorncp/ReviewSite.git","ssh_url":"git@github.com:thorncp/ReviewSite.git","clone_url":"https://github.com/thorncp/ReviewSite.git","svn_url":"https://github.com/thorncp/ReviewSite","homepage":null,"size":0,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"thorncp:master","ref":"master","sha":"ef64c6a86e31a676b14dbeae89d101074307898d","user":{"login":"thorncp","id":72176,"avatar_url":"https://avatars.githubusercontent.com/u/72176?v=3","gravatar_id":"","url":"https://api.github.com/users/thorncp","html_url":"https://github.com/thorncp","followers_url":"https://api.github.com/users/thorncp/followers","following_url":"https://api.github.com/users/thorncp/following{/other_user}","gists_url":"https://api.github.com/users/thorncp/gists{/gist_id}","starred_url":"https://api.github.com/users/thorncp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thorncp/subscriptions","organizations_url":"https://api.github.com/users/thorncp/orgs","repos_url":"https://api.github.com/users/thorncp/repos","events_url":"https://api.github.com/users/thorncp/events{/privacy}","received_events_url":"https://api.github.com/users/thorncp/received_events","type":"User","site_admin":false},"repo":{"id":28833458,"name":"ReviewSite","full_name":"thorncp/ReviewSite","owner":{"login":"thorncp","id":72176,"avatar_url":"https://avatars.githubusercontent.com/u/72176?v=3","gravatar_id":"","url":"https://api.github.com/users/thorncp","html_url":"https://github.com/thorncp","followers_url":"https://api.github.com/users/thorncp/followers","following_url":"https://api.github.com/users/thorncp/following{/other_user}","gists_url":"https://api.github.com/users/thorncp/gists{/gist_id}","starred_url":"https://api.github.com/users/thorncp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thorncp/subscriptions","organizations_url":"https://api.github.com/users/thorncp/orgs","repos_url":"https://api.github.com/users/thorncp/repos","events_url":"https://api.github.com/users/thorncp/events{/privacy}","received_events_url":"https://api.github.com/users/thorncp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thorncp/ReviewSite","description":"","fork":false,"url":"https://api.github.com/repos/thorncp/ReviewSite","forks_url":"https://api.github.com/repos/thorncp/ReviewSite/forks","keys_url":"https://api.github.com/repos/thorncp/ReviewSite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thorncp/ReviewSite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thorncp/ReviewSite/teams","hooks_url":"https://api.github.com/repos/thorncp/ReviewSite/hooks","issue_events_url":"https://api.github.com/repos/thorncp/ReviewSite/issues/events{/number}","events_url":"https://api.github.com/repos/thorncp/ReviewSite/events","assignees_url":"https://api.github.com/repos/thorncp/ReviewSite/assignees{/user}","branches_url":"https://api.github.com/repos/thorncp/ReviewSite/branches{/branch}","tags_url":"https://api.github.com/repos/thorncp/ReviewSite/tags","blobs_url":"https://api.github.com/repos/thorncp/ReviewSite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thorncp/ReviewSite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thorncp/ReviewSite/git/refs{/sha}","trees_url":"https://api.github.com/repos/thorncp/ReviewSite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thorncp/ReviewSite/statuses/{sha}","languages_url":"https://api.github.com/repos/thorncp/ReviewSite/languages","stargazers_url":"https://api.github.com/repos/thorncp/ReviewSite/stargazers","contributors_url":"https://api.github.com/repos/thorncp/ReviewSite/contributors","subscribers_url":"https://api.github.com/repos/thorncp/ReviewSite/subscribers","subscription_url":"https://api.github.com/repos/thorncp/ReviewSite/subscription","commits_url":"https://api.github.com/repos/thorncp/ReviewSite/commits{/sha}","git_commits_url":"https://api.github.com/repos/thorncp/ReviewSite/git/commits{/sha}","comments_url":"https://api.github.com/repos/thorncp/ReviewSite/comments{/number}","issue_comment_url":"https://api.github.com/repos/thorncp/ReviewSite/issues/comments/{number}","contents_url":"https://api.github.com/repos/thorncp/ReviewSite/contents/{+path}","compare_url":"https://api.github.com/repos/thorncp/ReviewSite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thorncp/ReviewSite/merges","archive_url":"https://api.github.com/repos/thorncp/ReviewSite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thorncp/ReviewSite/downloads","issues_url":"https://api.github.com/repos/thorncp/ReviewSite/issues{/number}","pulls_url":"https://api.github.com/repos/thorncp/ReviewSite/pulls{/number}","milestones_url":"https://api.github.com/repos/thorncp/ReviewSite/milestones{/number}","notifications_url":"https://api.github.com/repos/thorncp/ReviewSite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thorncp/ReviewSite/labels{/name}","releases_url":"https://api.github.com/repos/thorncp/ReviewSite/releases{/id}","created_at":"2015-01-05T21:49:16Z","updated_at":"2015-01-05T21:49:26Z","pushed_at":"2015-01-06T00:21:03Z","git_url":"git://github.com/thorncp/ReviewSite.git","ssh_url":"git@github.com:thorncp/ReviewSite.git","clone_url":"https://github.com/thorncp/ReviewSite.git","svn_url":"https://github.com/thorncp/ReviewSite","homepage":null,"size":0,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thorncp/ReviewSite/pulls/8"},"html":{"href":"https://github.com/thorncp/ReviewSite/pull/8"},"issue":{"href":"https://api.github.com/repos/thorncp/ReviewSite/issues/8"},"comments":{"href":"https://api.github.com/repos/thorncp/ReviewSite/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/thorncp/ReviewSite/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/thorncp/ReviewSite/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/thorncp/ReviewSite/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/thorncp/ReviewSite/statuses/de255ff8967687e0b5041dc5b839349295d1597d"}}}}