{"action":"created","comment":{"url":"https://api.github.com/repos/discourse/discourse/pulls/comments/36342986","id":36342986,"diff_hunk":"@@ -0,0 +1,72 @@\n+\n+class Like < PostAction\n+\n+  self.table_name = :likes\n+\n+  def self.pa_type\n+    PostActionType.like\n+  end\n+\n+  def pa_type\n+    self.class.pa_type\n+  end\n+\n+  # === BEGIN CRAZY SUBCLASSING MADNESS === #","path":"app/models/like.rb","position":14,"original_position":14,"commit_id":"1bcbe3ef2f91da9b5c1df6b7098404a42cf2ba6f","original_commit_id":"1bcbe3ef2f91da9b5c1df6b7098404a42cf2ba6f","user":{"login":"eviltrout","id":17538,"avatar_url":"https://avatars.githubusercontent.com/u/17538?v=3","gravatar_id":"","url":"https://api.github.com/users/eviltrout","html_url":"https://github.com/eviltrout","followers_url":"https://api.github.com/users/eviltrout/followers","following_url":"https://api.github.com/users/eviltrout/following{/other_user}","gists_url":"https://api.github.com/users/eviltrout/gists{/gist_id}","starred_url":"https://api.github.com/users/eviltrout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eviltrout/subscriptions","organizations_url":"https://api.github.com/users/eviltrout/orgs","repos_url":"https://api.github.com/users/eviltrout/repos","events_url":"https://api.github.com/users/eviltrout/events{/privacy}","received_events_url":"https://api.github.com/users/eviltrout/received_events","type":"User","site_admin":false},"body":"Firstly I don't think we need to comment this way. I don't think it adds much to the code to just call it crazy. Either explain why something is done or let's leave out the comment altogether.\r\n\r\nSecondly, can't this come from PostAction? It seems for Bookmark a lot of the code is shared. If we can't inherit it because it's class methods, how about using a mixin to avoid repeating ourselves?","created_at":"2015-08-05T19:21:54Z","updated_at":"2015-08-05T19:21:54Z","html_url":"https://github.com/discourse/discourse/pull/3642#discussion_r36342986","pull_request_url":"https://api.github.com/repos/discourse/discourse/pulls/3642","_links":{"self":{"href":"https://api.github.com/repos/discourse/discourse/pulls/comments/36342986"},"html":{"href":"https://github.com/discourse/discourse/pull/3642#discussion_r36342986"},"pull_request":{"href":"https://api.github.com/repos/discourse/discourse/pulls/3642"}}},"pull_request":{"url":"https://api.github.com/repos/discourse/discourse/pulls/3642","id":41710055,"html_url":"https://github.com/discourse/discourse/pull/3642","diff_url":"https://github.com/discourse/discourse/pull/3642.diff","patch_url":"https://github.com/discourse/discourse/pull/3642.patch","issue_url":"https://api.github.com/repos/discourse/discourse/issues/3642","number":3642,"state":"open","locked":false,"title":"Split post_actions table into views","user":{"login":"riking","id":627891,"avatar_url":"https://avatars.githubusercontent.com/u/627891?v=3","gravatar_id":"","url":"https://api.github.com/users/riking","html_url":"https://github.com/riking","followers_url":"https://api.github.com/users/riking/followers","following_url":"https://api.github.com/users/riking/following{/other_user}","gists_url":"https://api.github.com/users/riking/gists{/gist_id}","starred_url":"https://api.github.com/users/riking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riking/subscriptions","organizations_url":"https://api.github.com/users/riking/orgs","repos_url":"https://api.github.com/users/riking/repos","events_url":"https://api.github.com/users/riking/events{/privacy}","received_events_url":"https://api.github.com/users/riking/received_events","type":"User","site_admin":false},"body":"Splitting the post actions table.\r\n\r\n - Adds an updatable view, so you can create a Like object and save it (but we don't, because PostAction.act is the creation method)\r\n - Uses ActiveRecord single-table inheritance on the post_action_type_id column\r\n - Flag-only class methods on PostAction were moved & delegated\r\n\r\nI have verified with the SQL console that the likes and bookmarks views can be INSERTed into.\r\n\r\nTests pass, but no new tests were added.","created_at":"2015-08-05T18:26:49Z","updated_at":"2015-08-05T19:21:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb8f590262220dfc8dcd7a78d97c1bd6056cac3b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/discourse/discourse/pulls/3642/commits","review_comments_url":"https://api.github.com/repos/discourse/discourse/pulls/3642/comments","review_comment_url":"https://api.github.com/repos/discourse/discourse/pulls/comments{/number}","comments_url":"https://api.github.com/repos/discourse/discourse/issues/3642/comments","statuses_url":"https://api.github.com/repos/discourse/discourse/statuses/1bcbe3ef2f91da9b5c1df6b7098404a42cf2ba6f","head":{"label":"riking:split-post-actions","ref":"split-post-actions","sha":"1bcbe3ef2f91da9b5c1df6b7098404a42cf2ba6f","user":{"login":"riking","id":627891,"avatar_url":"https://avatars.githubusercontent.com/u/627891?v=3","gravatar_id":"","url":"https://api.github.com/users/riking","html_url":"https://github.com/riking","followers_url":"https://api.github.com/users/riking/followers","following_url":"https://api.github.com/users/riking/following{/other_user}","gists_url":"https://api.github.com/users/riking/gists{/gist_id}","starred_url":"https://api.github.com/users/riking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riking/subscriptions","organizations_url":"https://api.github.com/users/riking/orgs","repos_url":"https://api.github.com/users/riking/repos","events_url":"https://api.github.com/users/riking/events{/privacy}","received_events_url":"https://api.github.com/users/riking/received_events","type":"User","site_admin":false},"repo":{"id":12501210,"name":"discourse","full_name":"riking/discourse","owner":{"login":"riking","id":627891,"avatar_url":"https://avatars.githubusercontent.com/u/627891?v=3","gravatar_id":"","url":"https://api.github.com/users/riking","html_url":"https://github.com/riking","followers_url":"https://api.github.com/users/riking/followers","following_url":"https://api.github.com/users/riking/following{/other_user}","gists_url":"https://api.github.com/users/riking/gists{/gist_id}","starred_url":"https://api.github.com/users/riking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riking/subscriptions","organizations_url":"https://api.github.com/users/riking/orgs","repos_url":"https://api.github.com/users/riking/repos","events_url":"https://api.github.com/users/riking/events{/privacy}","received_events_url":"https://api.github.com/users/riking/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/riking/discourse","description":"A platform for community discussion. Free, open, simple.","fork":true,"url":"https://api.github.com/repos/riking/discourse","forks_url":"https://api.github.com/repos/riking/discourse/forks","keys_url":"https://api.github.com/repos/riking/discourse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/riking/discourse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/riking/discourse/teams","hooks_url":"https://api.github.com/repos/riking/discourse/hooks","issue_events_url":"https://api.github.com/repos/riking/discourse/issues/events{/number}","events_url":"https://api.github.com/repos/riking/discourse/events","assignees_url":"https://api.github.com/repos/riking/discourse/assignees{/user}","branches_url":"https://api.github.com/repos/riking/discourse/branches{/branch}","tags_url":"https://api.github.com/repos/riking/discourse/tags","blobs_url":"https://api.github.com/repos/riking/discourse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/riking/discourse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/riking/discourse/git/refs{/sha}","trees_url":"https://api.github.com/repos/riking/discourse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/riking/discourse/statuses/{sha}","languages_url":"https://api.github.com/repos/riking/discourse/languages","stargazers_url":"https://api.github.com/repos/riking/discourse/stargazers","contributors_url":"https://api.github.com/repos/riking/discourse/contributors","subscribers_url":"https://api.github.com/repos/riking/discourse/subscribers","subscription_url":"https://api.github.com/repos/riking/discourse/subscription","commits_url":"https://api.github.com/repos/riking/discourse/commits{/sha}","git_commits_url":"https://api.github.com/repos/riking/discourse/git/commits{/sha}","comments_url":"https://api.github.com/repos/riking/discourse/comments{/number}","issue_comment_url":"https://api.github.com/repos/riking/discourse/issues/comments{/number}","contents_url":"https://api.github.com/repos/riking/discourse/contents/{+path}","compare_url":"https://api.github.com/repos/riking/discourse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/riking/discourse/merges","archive_url":"https://api.github.com/repos/riking/discourse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/riking/discourse/downloads","issues_url":"https://api.github.com/repos/riking/discourse/issues{/number}","pulls_url":"https://api.github.com/repos/riking/discourse/pulls{/number}","milestones_url":"https://api.github.com/repos/riking/discourse/milestones{/number}","notifications_url":"https://api.github.com/repos/riking/discourse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/riking/discourse/labels{/name}","releases_url":"https://api.github.com/repos/riking/discourse/releases{/id}","created_at":"2013-08-31T05:48:44Z","updated_at":"2015-04-24T17:26:43Z","pushed_at":"2015-08-05T18:53:50Z","git_url":"git://github.com/riking/discourse.git","ssh_url":"git@github.com:riking/discourse.git","clone_url":"https://github.com/riking/discourse.git","svn_url":"https://github.com/riking/discourse","homepage":"http://www.discourse.org","size":96971,"stargazers_count":1,"watchers_count":1,"language":"Ruby","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":1,"default_branch":"master"}},"base":{"label":"discourse:master","ref":"master","sha":"35e6e5ff677e40304d3624de88147cda5b7b82f8","user":{"login":"discourse","id":3220138,"avatar_url":"https://avatars.githubusercontent.com/u/3220138?v=3","gravatar_id":"","url":"https://api.github.com/users/discourse","html_url":"https://github.com/discourse","followers_url":"https://api.github.com/users/discourse/followers","following_url":"https://api.github.com/users/discourse/following{/other_user}","gists_url":"https://api.github.com/users/discourse/gists{/gist_id}","starred_url":"https://api.github.com/users/discourse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discourse/subscriptions","organizations_url":"https://api.github.com/users/discourse/orgs","repos_url":"https://api.github.com/users/discourse/repos","events_url":"https://api.github.com/users/discourse/events{/privacy}","received_events_url":"https://api.github.com/users/discourse/received_events","type":"Organization","site_admin":false},"repo":{"id":7569578,"name":"discourse","full_name":"discourse/discourse","owner":{"login":"discourse","id":3220138,"avatar_url":"https://avatars.githubusercontent.com/u/3220138?v=3","gravatar_id":"","url":"https://api.github.com/users/discourse","html_url":"https://github.com/discourse","followers_url":"https://api.github.com/users/discourse/followers","following_url":"https://api.github.com/users/discourse/following{/other_user}","gists_url":"https://api.github.com/users/discourse/gists{/gist_id}","starred_url":"https://api.github.com/users/discourse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discourse/subscriptions","organizations_url":"https://api.github.com/users/discourse/orgs","repos_url":"https://api.github.com/users/discourse/repos","events_url":"https://api.github.com/users/discourse/events{/privacy}","received_events_url":"https://api.github.com/users/discourse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/discourse/discourse","description":"A platform for community discussion. Free, open, simple.","fork":false,"url":"https://api.github.com/repos/discourse/discourse","forks_url":"https://api.github.com/repos/discourse/discourse/forks","keys_url":"https://api.github.com/repos/discourse/discourse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/discourse/discourse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/discourse/discourse/teams","hooks_url":"https://api.github.com/repos/discourse/discourse/hooks","issue_events_url":"https://api.github.com/repos/discourse/discourse/issues/events{/number}","events_url":"https://api.github.com/repos/discourse/discourse/events","assignees_url":"https://api.github.com/repos/discourse/discourse/assignees{/user}","branches_url":"https://api.github.com/repos/discourse/discourse/branches{/branch}","tags_url":"https://api.github.com/repos/discourse/discourse/tags","blobs_url":"https://api.github.com/repos/discourse/discourse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/discourse/discourse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/discourse/discourse/git/refs{/sha}","trees_url":"https://api.github.com/repos/discourse/discourse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/discourse/discourse/statuses/{sha}","languages_url":"https://api.github.com/repos/discourse/discourse/languages","stargazers_url":"https://api.github.com/repos/discourse/discourse/stargazers","contributors_url":"https://api.github.com/repos/discourse/discourse/contributors","subscribers_url":"https://api.github.com/repos/discourse/discourse/subscribers","subscription_url":"https://api.github.com/repos/discourse/discourse/subscription","commits_url":"https://api.github.com/repos/discourse/discourse/commits{/sha}","git_commits_url":"https://api.github.com/repos/discourse/discourse/git/commits{/sha}","comments_url":"https://api.github.com/repos/discourse/discourse/comments{/number}","issue_comment_url":"https://api.github.com/repos/discourse/discourse/issues/comments{/number}","contents_url":"https://api.github.com/repos/discourse/discourse/contents/{+path}","compare_url":"https://api.github.com/repos/discourse/discourse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/discourse/discourse/merges","archive_url":"https://api.github.com/repos/discourse/discourse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/discourse/discourse/downloads","issues_url":"https://api.github.com/repos/discourse/discourse/issues{/number}","pulls_url":"https://api.github.com/repos/discourse/discourse/pulls{/number}","milestones_url":"https://api.github.com/repos/discourse/discourse/milestones{/number}","notifications_url":"https://api.github.com/repos/discourse/discourse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/discourse/discourse/labels{/name}","releases_url":"https://api.github.com/repos/discourse/discourse/releases{/id}","created_at":"2013-01-12T00:25:55Z","updated_at":"2015-08-05T14:14:41Z","pushed_at":"2015-08-05T19:15:15Z","git_url":"git://github.com/discourse/discourse.git","ssh_url":"git@github.com:discourse/discourse.git","clone_url":"https://github.com/discourse/discourse.git","svn_url":"https://github.com/discourse/discourse","homepage":"http://www.discourse.org","size":204575,"stargazers_count":15329,"watchers_count":15329,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4106,"mirror_url":null,"open_issues_count":11,"forks":4106,"open_issues":11,"watchers":15329,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/discourse/discourse/pulls/3642"},"html":{"href":"https://github.com/discourse/discourse/pull/3642"},"issue":{"href":"https://api.github.com/repos/discourse/discourse/issues/3642"},"comments":{"href":"https://api.github.com/repos/discourse/discourse/issues/3642/comments"},"review_comments":{"href":"https://api.github.com/repos/discourse/discourse/pulls/3642/comments"},"review_comment":{"href":"https://api.github.com/repos/discourse/discourse/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/discourse/discourse/pulls/3642/commits"},"statuses":{"href":"https://api.github.com/repos/discourse/discourse/statuses/1bcbe3ef2f91da9b5c1df6b7098404a42cf2ba6f"}}}}