{"action":"created","comment":{"url":"https://api.github.com/repos/groupbuddies/council/pulls/comments/22943088","id":22943088,"diff_hunk":"@@ -0,0 +1,32 @@\n+class Subscriber\n+  def self.for_discussion(discussion)\n+    new(discussion)\n+  end\n+\n+  def initialize(discussion)\n+    @discussion = discussion\n+    @subscriptions = Subscription.where(discussion_id: discussion.id)\n+  end","path":"app/models/subscriber.rb","position":9,"original_position":9,"commit_id":"5dec433edd6c5224af3809ed76e86463ae59a264","original_commit_id":"5dec433edd6c5224af3809ed76e86463ae59a264","user":{"login":"naps62","id":283819,"avatar_url":"https://avatars.githubusercontent.com/u/283819?v=3","gravatar_id":"","url":"https://api.github.com/users/naps62","html_url":"https://github.com/naps62","followers_url":"https://api.github.com/users/naps62/followers","following_url":"https://api.github.com/users/naps62/following{/other_user}","gists_url":"https://api.github.com/users/naps62/gists{/gist_id}","starred_url":"https://api.github.com/users/naps62/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naps62/subscriptions","organizations_url":"https://api.github.com/users/naps62/orgs","repos_url":"https://api.github.com/users/naps62/repos","events_url":"https://api.github.com/users/naps62/events{/privacy}","received_events_url":"https://api.github.com/users/naps62/received_events","type":"User","site_admin":false},"body":"any reason for having a `self.for_discussion` instead of just making this a named argument? `def initialize(discussion: discussion). I guess the end result is the same, but the current way allows you to still call the `new` method manually, which is probably not what you want","created_at":"2015-01-14T15:25:36Z","updated_at":"2015-01-14T15:25:36Z","html_url":"https://github.com/groupbuddies/council/pull/89#discussion_r22943088","pull_request_url":"https://api.github.com/repos/groupbuddies/council/pulls/89","_links":{"self":{"href":"https://api.github.com/repos/groupbuddies/council/pulls/comments/22943088"},"html":{"href":"https://github.com/groupbuddies/council/pull/89#discussion_r22943088"},"pull_request":{"href":"https://api.github.com/repos/groupbuddies/council/pulls/89"}}},"pull_request":{"url":"https://api.github.com/repos/groupbuddies/council/pulls/89","id":27199301,"html_url":"https://github.com/groupbuddies/council/pull/89","diff_url":"https://github.com/groupbuddies/council/pull/89.diff","patch_url":"https://github.com/groupbuddies/council/pull/89.patch","issue_url":"https://api.github.com/repos/groupbuddies/council/issues/89","number":89,"state":"open","locked":false,"title":"[Models] Improves subscription update system","user":{"login":"zamith","id":166304,"avatar_url":"https://avatars.githubusercontent.com/u/166304?v=3","gravatar_id":"","url":"https://api.github.com/users/zamith","html_url":"https://github.com/zamith","followers_url":"https://api.github.com/users/zamith/followers","following_url":"https://api.github.com/users/zamith/following{/other_user}","gists_url":"https://api.github.com/users/zamith/gists{/gist_id}","starred_url":"https://api.github.com/users/zamith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zamith/subscriptions","organizations_url":"https://api.github.com/users/zamith/orgs","repos_url":"https://api.github.com/users/zamith/repos","events_url":"https://api.github.com/users/zamith/events{/privacy}","received_events_url":"https://api.github.com/users/zamith/received_events","type":"User","site_admin":false},"body":"Gets all the subscriptions in bulk and searches in memory, instead of a\nquery per user. Also calls the subscription set_initial_state callback\nbefore save, instead of after, thus saving an access to the db per new\nsubscription created.\n\nMoves the logic of creating subscriptions into it's own object. This\nstill does not deal with users unsubscribing to discussion, but it's a\nstep towards that.","created_at":"2015-01-12T14:58:15Z","updated_at":"2015-01-14T15:25:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5905a347124b8ac38a34e981a0195c576b15e71d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/groupbuddies/council/pulls/89/commits","review_comments_url":"https://api.github.com/repos/groupbuddies/council/pulls/89/comments","review_comment_url":"https://api.github.com/repos/groupbuddies/council/pulls/comments/{number}","comments_url":"https://api.github.com/repos/groupbuddies/council/issues/89/comments","statuses_url":"https://api.github.com/repos/groupbuddies/council/statuses/5dec433edd6c5224af3809ed76e86463ae59a264","head":{"label":"groupbuddies:zh-better-subscriptions","ref":"zh-better-subscriptions","sha":"5dec433edd6c5224af3809ed76e86463ae59a264","user":{"login":"groupbuddies","id":1085467,"avatar_url":"https://avatars.githubusercontent.com/u/1085467?v=3","gravatar_id":"","url":"https://api.github.com/users/groupbuddies","html_url":"https://github.com/groupbuddies","followers_url":"https://api.github.com/users/groupbuddies/followers","following_url":"https://api.github.com/users/groupbuddies/following{/other_user}","gists_url":"https://api.github.com/users/groupbuddies/gists{/gist_id}","starred_url":"https://api.github.com/users/groupbuddies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupbuddies/subscriptions","organizations_url":"https://api.github.com/users/groupbuddies/orgs","repos_url":"https://api.github.com/users/groupbuddies/repos","events_url":"https://api.github.com/users/groupbuddies/events{/privacy}","received_events_url":"https://api.github.com/users/groupbuddies/received_events","type":"Organization","site_admin":false},"repo":{"id":27681807,"name":"council","full_name":"groupbuddies/council","owner":{"login":"groupbuddies","id":1085467,"avatar_url":"https://avatars.githubusercontent.com/u/1085467?v=3","gravatar_id":"","url":"https://api.github.com/users/groupbuddies","html_url":"https://github.com/groupbuddies","followers_url":"https://api.github.com/users/groupbuddies/followers","following_url":"https://api.github.com/users/groupbuddies/following{/other_user}","gists_url":"https://api.github.com/users/groupbuddies/gists{/gist_id}","starred_url":"https://api.github.com/users/groupbuddies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupbuddies/subscriptions","organizations_url":"https://api.github.com/users/groupbuddies/orgs","repos_url":"https://api.github.com/users/groupbuddies/repos","events_url":"https://api.github.com/users/groupbuddies/events{/privacy}","received_events_url":"https://api.github.com/users/groupbuddies/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/groupbuddies/council","description":"","fork":false,"url":"https://api.github.com/repos/groupbuddies/council","forks_url":"https://api.github.com/repos/groupbuddies/council/forks","keys_url":"https://api.github.com/repos/groupbuddies/council/keys{/key_id}","collaborators_url":"https://api.github.com/repos/groupbuddies/council/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/groupbuddies/council/teams","hooks_url":"https://api.github.com/repos/groupbuddies/council/hooks","issue_events_url":"https://api.github.com/repos/groupbuddies/council/issues/events{/number}","events_url":"https://api.github.com/repos/groupbuddies/council/events","assignees_url":"https://api.github.com/repos/groupbuddies/council/assignees{/user}","branches_url":"https://api.github.com/repos/groupbuddies/council/branches{/branch}","tags_url":"https://api.github.com/repos/groupbuddies/council/tags","blobs_url":"https://api.github.com/repos/groupbuddies/council/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/groupbuddies/council/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/groupbuddies/council/git/refs{/sha}","trees_url":"https://api.github.com/repos/groupbuddies/council/git/trees{/sha}","statuses_url":"https://api.github.com/repos/groupbuddies/council/statuses/{sha}","languages_url":"https://api.github.com/repos/groupbuddies/council/languages","stargazers_url":"https://api.github.com/repos/groupbuddies/council/stargazers","contributors_url":"https://api.github.com/repos/groupbuddies/council/contributors","subscribers_url":"https://api.github.com/repos/groupbuddies/council/subscribers","subscription_url":"https://api.github.com/repos/groupbuddies/council/subscription","commits_url":"https://api.github.com/repos/groupbuddies/council/commits{/sha}","git_commits_url":"https://api.github.com/repos/groupbuddies/council/git/commits{/sha}","comments_url":"https://api.github.com/repos/groupbuddies/council/comments{/number}","issue_comment_url":"https://api.github.com/repos/groupbuddies/council/issues/comments/{number}","contents_url":"https://api.github.com/repos/groupbuddies/council/contents/{+path}","compare_url":"https://api.github.com/repos/groupbuddies/council/compare/{base}...{head}","merges_url":"https://api.github.com/repos/groupbuddies/council/merges","archive_url":"https://api.github.com/repos/groupbuddies/council/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/groupbuddies/council/downloads","issues_url":"https://api.github.com/repos/groupbuddies/council/issues{/number}","pulls_url":"https://api.github.com/repos/groupbuddies/council/pulls{/number}","milestones_url":"https://api.github.com/repos/groupbuddies/council/milestones{/number}","notifications_url":"https://api.github.com/repos/groupbuddies/council/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/groupbuddies/council/labels{/name}","releases_url":"https://api.github.com/repos/groupbuddies/council/releases{/id}","created_at":"2014-12-07T19:28:26Z","updated_at":"2015-01-13T17:02:18Z","pushed_at":"2015-01-14T14:23:21Z","git_url":"git://github.com/groupbuddies/council.git","ssh_url":"git@github.com:groupbuddies/council.git","clone_url":"https://github.com/groupbuddies/council.git","svn_url":"https://github.com/groupbuddies/council","homepage":"http://council.groupbuddies.com","size":8199,"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":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"master"}},"base":{"label":"groupbuddies:master","ref":"master","sha":"88e6e5b39488739f52c7fa44c3adff69d021016f","user":{"login":"groupbuddies","id":1085467,"avatar_url":"https://avatars.githubusercontent.com/u/1085467?v=3","gravatar_id":"","url":"https://api.github.com/users/groupbuddies","html_url":"https://github.com/groupbuddies","followers_url":"https://api.github.com/users/groupbuddies/followers","following_url":"https://api.github.com/users/groupbuddies/following{/other_user}","gists_url":"https://api.github.com/users/groupbuddies/gists{/gist_id}","starred_url":"https://api.github.com/users/groupbuddies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupbuddies/subscriptions","organizations_url":"https://api.github.com/users/groupbuddies/orgs","repos_url":"https://api.github.com/users/groupbuddies/repos","events_url":"https://api.github.com/users/groupbuddies/events{/privacy}","received_events_url":"https://api.github.com/users/groupbuddies/received_events","type":"Organization","site_admin":false},"repo":{"id":27681807,"name":"council","full_name":"groupbuddies/council","owner":{"login":"groupbuddies","id":1085467,"avatar_url":"https://avatars.githubusercontent.com/u/1085467?v=3","gravatar_id":"","url":"https://api.github.com/users/groupbuddies","html_url":"https://github.com/groupbuddies","followers_url":"https://api.github.com/users/groupbuddies/followers","following_url":"https://api.github.com/users/groupbuddies/following{/other_user}","gists_url":"https://api.github.com/users/groupbuddies/gists{/gist_id}","starred_url":"https://api.github.com/users/groupbuddies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groupbuddies/subscriptions","organizations_url":"https://api.github.com/users/groupbuddies/orgs","repos_url":"https://api.github.com/users/groupbuddies/repos","events_url":"https://api.github.com/users/groupbuddies/events{/privacy}","received_events_url":"https://api.github.com/users/groupbuddies/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/groupbuddies/council","description":"","fork":false,"url":"https://api.github.com/repos/groupbuddies/council","forks_url":"https://api.github.com/repos/groupbuddies/council/forks","keys_url":"https://api.github.com/repos/groupbuddies/council/keys{/key_id}","collaborators_url":"https://api.github.com/repos/groupbuddies/council/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/groupbuddies/council/teams","hooks_url":"https://api.github.com/repos/groupbuddies/council/hooks","issue_events_url":"https://api.github.com/repos/groupbuddies/council/issues/events{/number}","events_url":"https://api.github.com/repos/groupbuddies/council/events","assignees_url":"https://api.github.com/repos/groupbuddies/council/assignees{/user}","branches_url":"https://api.github.com/repos/groupbuddies/council/branches{/branch}","tags_url":"https://api.github.com/repos/groupbuddies/council/tags","blobs_url":"https://api.github.com/repos/groupbuddies/council/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/groupbuddies/council/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/groupbuddies/council/git/refs{/sha}","trees_url":"https://api.github.com/repos/groupbuddies/council/git/trees{/sha}","statuses_url":"https://api.github.com/repos/groupbuddies/council/statuses/{sha}","languages_url":"https://api.github.com/repos/groupbuddies/council/languages","stargazers_url":"https://api.github.com/repos/groupbuddies/council/stargazers","contributors_url":"https://api.github.com/repos/groupbuddies/council/contributors","subscribers_url":"https://api.github.com/repos/groupbuddies/council/subscribers","subscription_url":"https://api.github.com/repos/groupbuddies/council/subscription","commits_url":"https://api.github.com/repos/groupbuddies/council/commits{/sha}","git_commits_url":"https://api.github.com/repos/groupbuddies/council/git/commits{/sha}","comments_url":"https://api.github.com/repos/groupbuddies/council/comments{/number}","issue_comment_url":"https://api.github.com/repos/groupbuddies/council/issues/comments/{number}","contents_url":"https://api.github.com/repos/groupbuddies/council/contents/{+path}","compare_url":"https://api.github.com/repos/groupbuddies/council/compare/{base}...{head}","merges_url":"https://api.github.com/repos/groupbuddies/council/merges","archive_url":"https://api.github.com/repos/groupbuddies/council/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/groupbuddies/council/downloads","issues_url":"https://api.github.com/repos/groupbuddies/council/issues{/number}","pulls_url":"https://api.github.com/repos/groupbuddies/council/pulls{/number}","milestones_url":"https://api.github.com/repos/groupbuddies/council/milestones{/number}","notifications_url":"https://api.github.com/repos/groupbuddies/council/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/groupbuddies/council/labels{/name}","releases_url":"https://api.github.com/repos/groupbuddies/council/releases{/id}","created_at":"2014-12-07T19:28:26Z","updated_at":"2015-01-13T17:02:18Z","pushed_at":"2015-01-14T14:23:21Z","git_url":"git://github.com/groupbuddies/council.git","ssh_url":"git@github.com:groupbuddies/council.git","clone_url":"https://github.com/groupbuddies/council.git","svn_url":"https://github.com/groupbuddies/council","homepage":"http://council.groupbuddies.com","size":8199,"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":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/groupbuddies/council/pulls/89"},"html":{"href":"https://github.com/groupbuddies/council/pull/89"},"issue":{"href":"https://api.github.com/repos/groupbuddies/council/issues/89"},"comments":{"href":"https://api.github.com/repos/groupbuddies/council/issues/89/comments"},"review_comments":{"href":"https://api.github.com/repos/groupbuddies/council/pulls/89/comments"},"review_comment":{"href":"https://api.github.com/repos/groupbuddies/council/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/groupbuddies/council/pulls/89/commits"},"statuses":{"href":"https://api.github.com/repos/groupbuddies/council/statuses/5dec433edd6c5224af3809ed76e86463ae59a264"}}}}