GitHub PullRequestReviewCommentEvent at 2014-07-24 18:33:20
Repository: craigstr
Actor: ChristopherThorsen
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/liantics/craigstr/pulls/comments/15363976","id":15363976,"diff_hunk":"@@ -3,4 +3,14 @@ class User < ActiveRecord::Base\n   validates :password_digest, presence: true\n \n   has_many :posts\n+\n+  def allowed_to_modify_post?(post)\n+    admin? || post_owner?(post)\n+  end\n+\n+  def post_owner?(post)\n+    if post.user_id == self.id","path":"app/models/user.rb","position":10,"original_position":10,"commit_id":"903e633a6ca90fadadb008d6bdcbeefc12fa9ecc","original_commit_id":"903e633a6ca90fadadb008d6bdcbeefc12fa9ecc","user":{"login":"ChristopherThorsen","id":7708039,"avatar_url":"https://avatars.githubusercontent.com/u/7708039?","gravatar_id":"2b34ce5e8d66f82b0b85837be44b4cc2","url":"https://api.github.com/users/ChristopherThorsen","html_url":"https://github.com/ChristopherThorsen","followers_url":"https://api.github.com/users/ChristopherThorsen/followers","following_url":"https://api.github.com/users/ChristopherThorsen/following{/other_user}","gists_url":"https://api.github.com/users/ChristopherThorsen/gists{/gist_id}","starred_url":"https://api.github.com/users/ChristopherThorsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChristopherThorsen/subscriptions","organizations_url":"https://api.github.com/users/ChristopherThorsen/orgs","repos_url":"https://api.github.com/users/ChristopherThorsen/repos","events_url":"https://api.github.com/users/ChristopherThorsen/events{/privacy}","received_events_url":"https://api.github.com/users/ChristopherThorsen/received_events","type":"User","site_admin":false},"body":"could we just call user.posts ","created_at":"2014-07-24T18:33:20Z","updated_at":"2014-07-24T18:33:20Z","html_url":"https://github.com/liantics/craigstr/pull/25#discussion_r15363976","pull_request_url":"https://api.github.com/repos/liantics/craigstr/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/liantics/craigstr/pulls/comments/15363976"},"html":{"href":"https://github.com/liantics/craigstr/pull/25#discussion_r15363976"},"pull_request":{"href":"https://api.github.com/repos/liantics/craigstr/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/liantics/craigstr/pulls/25","id":18853953,"html_url":"https://github.com/liantics/craigstr/pull/25","diff_url":"https://github.com/liantics/craigstr/pull/25.diff","patch_url":"https://github.com/liantics/craigstr/pull/25.patch","issue_url":"https://api.github.com/repos/liantics/craigstr/issues/25","number":25,"state":"open","title":"Lea user delete posts","user":{"login":"liantics","id":3310162,"avatar_url":"https://avatars.githubusercontent.com/u/3310162?","gravatar_id":"768ff9057a85f808fdf685136baf890a","url":"https://api.github.com/users/liantics","html_url":"https://github.com/liantics","followers_url":"https://api.github.com/users/liantics/followers","following_url":"https://api.github.com/users/liantics/following{/other_user}","gists_url":"https://api.github.com/users/liantics/gists{/gist_id}","starred_url":"https://api.github.com/users/liantics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liantics/subscriptions","organizations_url":"https://api.github.com/users/liantics/orgs","repos_url":"https://api.github.com/users/liantics/repos","events_url":"https://api.github.com/users/liantics/events{/privacy}","received_events_url":"https://api.github.com/users/liantics/received_events","type":"User","site_admin":false},"body":"1) Address this comment on the now-non-existent original pull request:\r\n\r\nIn app/controllers/posts_controller.rb:\r\n> +  before_action :ensure_user_can_modify_post, only: [:edit, :update, :destroy]\r\n\r\nI recommend doing away with the before_action (We typically try to avoid them whenever possible. They are harder to reason about because they are defined far away from where they actually happen, so sometimes you can miss that they are going to get called). I recommend defining a method on user accessible_posts that returns all posts for admins, and posts for anyone else. then just finding the posts through the current_user\r\n\r\n2) Fix a redirect bug in locations controller\r\n\r\n3) Remove instance variables that are no longer used on posts index page","created_at":"2014-07-24T18:13:31Z","updated_at":"2014-07-24T18:33:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2004b82bb56d1df09221a00aca590935e0061fb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/liantics/craigstr/pulls/25/commits","review_comments_url":"https://api.github.com/repos/liantics/craigstr/pulls/25/comments","review_comment_url":"https://api.github.com/repos/liantics/craigstr/pulls/comments/{number}","comments_url":"https://api.github.com/repos/liantics/craigstr/issues/25/comments","statuses_url":"https://api.github.com/repos/liantics/craigstr/statuses/903e633a6ca90fadadb008d6bdcbeefc12fa9ecc","head":{"label":"liantics:lea-user-delete-posts","ref":"lea-user-delete-posts","sha":"903e633a6ca90fadadb008d6bdcbeefc12fa9ecc","user":{"login":"liantics","id":3310162,"avatar_url":"https://avatars.githubusercontent.com/u/3310162?","gravatar_id":"768ff9057a85f808fdf685136baf890a","url":"https://api.github.com/users/liantics","html_url":"https://github.com/liantics","followers_url":"https://api.github.com/users/liantics/followers","following_url":"https://api.github.com/users/liantics/following{/other_user}","gists_url":"https://api.github.com/users/liantics/gists{/gist_id}","starred_url":"https://api.github.com/users/liantics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liantics/subscriptions","organizations_url":"https://api.github.com/users/liantics/orgs","repos_url":"https://api.github.com/users/liantics/repos","events_url":"https://api.github.com/users/liantics/events{/privacy}","received_events_url":"https://api.github.com/users/liantics/received_events","type":"User","site_admin":false},"repo":{"id":22066770,"name":"craigstr","full_name":"liantics/craigstr","owner":{"login":"liantics","id":3310162,"avatar_url":"https://avatars.githubusercontent.com/u/3310162?","gravatar_id":"768ff9057a85f808fdf685136baf890a","url":"https://api.github.com/users/liantics","html_url":"https://github.com/liantics","followers_url":"https://api.github.com/users/liantics/followers","following_url":"https://api.github.com/users/liantics/following{/other_user}","gists_url":"https://api.github.com/users/liantics/gists{/gist_id}","starred_url":"https://api.github.com/users/liantics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liantics/subscriptions","organizations_url":"https://api.github.com/users/liantics/orgs","repos_url":"https://api.github.com/users/liantics/repos","events_url":"https://api.github.com/users/liantics/events{/privacy}","received_events_url":"https://api.github.com/users/liantics/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/liantics/craigstr","description":"Craigslist clone - Metis team project","fork":false,"url":"https://api.github.com/repos/liantics/craigstr","forks_url":"https://api.github.com/repos/liantics/craigstr/forks","keys_url":"https://api.github.com/repos/liantics/craigstr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/liantics/craigstr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/liantics/craigstr/teams","hooks_url":"https://api.github.com/repos/liantics/craigstr/hooks","issue_events_url":"https://api.github.com/repos/liantics/craigstr/issues/events{/number}","events_url":"https://api.github.com/repos/liantics/craigstr/events","assignees_url":"https://api.github.com/repos/liantics/craigstr/assignees{/user}","branches_url":"https://api.github.com/repos/liantics/craigstr/branches{/branch}","tags_url":"https://api.github.com/repos/liantics/craigstr/tags","blobs_url":"https://api.github.com/repos/liantics/craigstr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/liantics/craigstr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/liantics/craigstr/git/refs{/sha}","trees_url":"https://api.github.com/repos/liantics/craigstr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/liantics/craigstr/statuses/{sha}","languages_url":"https://api.github.com/repos/liantics/craigstr/languages","stargazers_url":"https://api.github.com/repos/liantics/craigstr/stargazers","contributors_url":"https://api.github.com/repos/liantics/craigstr/contributors","subscribers_url":"https://api.github.com/repos/liantics/craigstr/subscribers","subscription_url":"https://api.github.com/repos/liantics/craigstr/subscription","commits_url":"https://api.github.com/repos/liantics/craigstr/commits{/sha}","git_commits_url":"https://api.github.com/repos/liantics/craigstr/git/commits{/sha}","comments_url":"https://api.github.com/repos/liantics/craigstr/comments{/number}","issue_comment_url":"https://api.github.com/repos/liantics/craigstr/issues/comments/{number}","contents_url":"https://api.github.com/repos/liantics/craigstr/contents/{+path}","compare_url":"https://api.github.com/repos/liantics/craigstr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/liantics/craigstr/merges","archive_url":"https://api.github.com/repos/liantics/craigstr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/liantics/craigstr/downloads","issues_url":"https://api.github.com/repos/liantics/craigstr/issues{/number}","pulls_url":"https://api.github.com/repos/liantics/craigstr/pulls{/number}","milestones_url":"https://api.github.com/repos/liantics/craigstr/milestones{/number}","notifications_url":"https://api.github.com/repos/liantics/craigstr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/liantics/craigstr/labels{/name}","releases_url":"https://api.github.com/repos/liantics/craigstr/releases{/id}","created_at":"2014-07-21T14:08:17Z","updated_at":"2014-07-21T14:08:31Z","pushed_at":"2014-07-24T18:09:24Z","git_url":"git://github.com/liantics/craigstr.git","ssh_url":"git@github.com:liantics/craigstr.git","clone_url":"https://github.com/liantics/craigstr.git","svn_url":"https://github.com/liantics/craigstr","homepage":null,"size":1912,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"liantics:master","ref":"master","sha":"6574ae085bebdb3c955ea34872a9a9282a7a9b41","user":{"login":"liantics","id":3310162,"avatar_url":"https://avatars.githubusercontent.com/u/3310162?","gravatar_id":"768ff9057a85f808fdf685136baf890a","url":"https://api.github.com/users/liantics","html_url":"https://github.com/liantics","followers_url":"https://api.github.com/users/liantics/followers","following_url":"https://api.github.com/users/liantics/following{/other_user}","gists_url":"https://api.github.com/users/liantics/gists{/gist_id}","starred_url":"https://api.github.com/users/liantics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liantics/subscriptions","organizations_url":"https://api.github.com/users/liantics/orgs","repos_url":"https://api.github.com/users/liantics/repos","events_url":"https://api.github.com/users/liantics/events{/privacy}","received_events_url":"https://api.github.com/users/liantics/received_events","type":"User","site_admin":false},"repo":{"id":22066770,"name":"craigstr","full_name":"liantics/craigstr","owner":{"login":"liantics","id":3310162,"avatar_url":"https://avatars.githubusercontent.com/u/3310162?","gravatar_id":"768ff9057a85f808fdf685136baf890a","url":"https://api.github.com/users/liantics","html_url":"https://github.com/liantics","followers_url":"https://api.github.com/users/liantics/followers","following_url":"https://api.github.com/users/liantics/following{/other_user}","gists_url":"https://api.github.com/users/liantics/gists{/gist_id}","starred_url":"https://api.github.com/users/liantics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liantics/subscriptions","organizations_url":"https://api.github.com/users/liantics/orgs","repos_url":"https://api.github.com/users/liantics/repos","events_url":"https://api.github.com/users/liantics/events{/privacy}","received_events_url":"https://api.github.com/users/liantics/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/liantics/craigstr","description":"Craigslist clone - Metis team project","fork":false,"url":"https://api.github.com/repos/liantics/craigstr","forks_url":"https://api.github.com/repos/liantics/craigstr/forks","keys_url":"https://api.github.com/repos/liantics/craigstr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/liantics/craigstr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/liantics/craigstr/teams","hooks_url":"https://api.github.com/repos/liantics/craigstr/hooks","issue_events_url":"https://api.github.com/repos/liantics/craigstr/issues/events{/number}","events_url":"https://api.github.com/repos/liantics/craigstr/events","assignees_url":"https://api.github.com/repos/liantics/craigstr/assignees{/user}","branches_url":"https://api.github.com/repos/liantics/craigstr/branches{/branch}","tags_url":"https://api.github.com/repos/liantics/craigstr/tags","blobs_url":"https://api.github.com/repos/liantics/craigstr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/liantics/craigstr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/liantics/craigstr/git/refs{/sha}","trees_url":"https://api.github.com/repos/liantics/craigstr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/liantics/craigstr/statuses/{sha}","languages_url":"https://api.github.com/repos/liantics/craigstr/languages","stargazers_url":"https://api.github.com/repos/liantics/craigstr/stargazers","contributors_url":"https://api.github.com/repos/liantics/craigstr/contributors","subscribers_url":"https://api.github.com/repos/liantics/craigstr/subscribers","subscription_url":"https://api.github.com/repos/liantics/craigstr/subscription","commits_url":"https://api.github.com/repos/liantics/craigstr/commits{/sha}","git_commits_url":"https://api.github.com/repos/liantics/craigstr/git/commits{/sha}","comments_url":"https://api.github.com/repos/liantics/craigstr/comments{/number}","issue_comment_url":"https://api.github.com/repos/liantics/craigstr/issues/comments/{number}","contents_url":"https://api.github.com/repos/liantics/craigstr/contents/{+path}","compare_url":"https://api.github.com/repos/liantics/craigstr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/liantics/craigstr/merges","archive_url":"https://api.github.com/repos/liantics/craigstr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/liantics/craigstr/downloads","issues_url":"https://api.github.com/repos/liantics/craigstr/issues{/number}","pulls_url":"https://api.github.com/repos/liantics/craigstr/pulls{/number}","milestones_url":"https://api.github.com/repos/liantics/craigstr/milestones{/number}","notifications_url":"https://api.github.com/repos/liantics/craigstr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/liantics/craigstr/labels{/name}","releases_url":"https://api.github.com/repos/liantics/craigstr/releases{/id}","created_at":"2014-07-21T14:08:17Z","updated_at":"2014-07-21T14:08:31Z","pushed_at":"2014-07-24T18:09:24Z","git_url":"git://github.com/liantics/craigstr.git","ssh_url":"git@github.com:liantics/craigstr.git","clone_url":"https://github.com/liantics/craigstr.git","svn_url":"https://github.com/liantics/craigstr","homepage":null,"size":1912,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/liantics/craigstr/pulls/25"},"html":{"href":"https://github.com/liantics/craigstr/pull/25"},"issue":{"href":"https://api.github.com/repos/liantics/craigstr/issues/25"},"comments":{"href":"https://api.github.com/repos/liantics/craigstr/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/liantics/craigstr/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/liantics/craigstr/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/liantics/craigstr/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/liantics/craigstr/statuses/903e633a6ca90fadadb008d6bdcbeefc12fa9ecc"}}}}