{"action":"created","comment":{"url":"https://api.github.com/repos/hypothesis/h/pulls/comments/165398994","pull_request_review_id":93331879,"id":165398994,"diff_hunk":"@@ -0,0 +1,39 @@\n+# -*- coding: utf-8 -*-\n+\n+\n+class ProfileGroupService(object):\n+\n+    \"\"\"A service for retrieving groups associated with users.\"\"\"\n+\n+    def __init__(self, session, open_group_finder):\n+        \"\"\"\n+        Create a new profile_groups service.\n+\n+        :param session: the SQLAlchemy session object\n+        :param open_group_finder: a callable for finding open groups\n+        \"\"\"\n+        self.session = session\n+        self.open_group_finder = open_group_finder\n+\n+    def all(self, user=None, authority=None):\n+        \"\"\" return a list of all user groups\"\"\"\n+\n+        open_groups = self.open_group_finder(authority) or []\n+        private_groups = []\n+        if user is not None:\n+            private_groups = user.groups\n+\n+        groups = open_groups + private_groups","path":"h/services/profile_group.py","position":26,"original_position":26,"commit_id":"4b3219ccfa6cd8865eeef47af5c2f1991eba42e8","original_commit_id":"4b3219ccfa6cd8865eeef47af5c2f1991eba42e8","user":{"login":"lyzadanger","id":439947,"avatar_url":"https://avatars2.githubusercontent.com/u/439947?v=4","gravatar_id":"","url":"https://api.github.com/users/lyzadanger","html_url":"https://github.com/lyzadanger","followers_url":"https://api.github.com/users/lyzadanger/followers","following_url":"https://api.github.com/users/lyzadanger/following{/other_user}","gists_url":"https://api.github.com/users/lyzadanger/gists{/gist_id}","starred_url":"https://api.github.com/users/lyzadanger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyzadanger/subscriptions","organizations_url":"https://api.github.com/users/lyzadanger/orgs","repos_url":"https://api.github.com/users/lyzadanger/repos","events_url":"https://api.github.com/users/lyzadanger/events{/privacy}","received_events_url":"https://api.github.com/users/lyzadanger/received_events","type":"User","site_admin":false},"body":"Yes, it would be (the _Public_ group). This part of the service, as well as the needs-to-be-renamed `authority_group` service, will need refactoring and review as we continue development—this isn't the end point of where this will end up, I'm sure.","created_at":"2018-02-01T15:54:43Z","updated_at":"2018-02-01T15:54:43Z","html_url":"https://github.com/hypothesis/h/pull/4758#discussion_r165398994","pull_request_url":"https://api.github.com/repos/hypothesis/h/pulls/4758","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/hypothesis/h/pulls/comments/165398994"},"html":{"href":"https://github.com/hypothesis/h/pull/4758#discussion_r165398994"},"pull_request":{"href":"https://api.github.com/repos/hypothesis/h/pulls/4758"}},"in_reply_to_id":165366415},"pull_request":{"url":"https://api.github.com/repos/hypothesis/h/pulls/4758","id":166310119,"html_url":"https://github.com/hypothesis/h/pull/4758","diff_url":"https://github.com/hypothesis/h/pull/4758.diff","patch_url":"https://github.com/hypothesis/h/pull/4758.patch","issue_url":"https://api.github.com/repos/hypothesis/h/issues/4758","number":4758,"state":"open","locked":false,"title":"Add rudimentary profile/groups API endpoint and service","user":{"login":"lyzadanger","id":439947,"avatar_url":"https://avatars2.githubusercontent.com/u/439947?v=4","gravatar_id":"","url":"https://api.github.com/users/lyzadanger","html_url":"https://github.com/lyzadanger","followers_url":"https://api.github.com/users/lyzadanger/followers","following_url":"https://api.github.com/users/lyzadanger/following{/other_user}","gists_url":"https://api.github.com/users/lyzadanger/gists{/gist_id}","starred_url":"https://api.github.com/users/lyzadanger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyzadanger/subscriptions","organizations_url":"https://api.github.com/users/lyzadanger/orgs","repos_url":"https://api.github.com/users/lyzadanger/repos","events_url":"https://api.github.com/users/lyzadanger/events{/privacy}","received_events_url":"https://api.github.com/users/lyzadanger/received_events","type":"User","site_admin":false},"body":"What this does:\r\n\r\n* Adds a new endpoint at `GET /profile/groups` with associated view and route\r\n* Adds a new service `ProfileGroupService` which will be ultimately responsible for building a list of applicable groups for a given user based on a number of factors\r\n* Satisfies the API signature and schema given in the exposed docs\r\n* Provides properties of pre-existing `GET /profile` `groups`, excepting `url` for the moment\r\n\r\nWhat this doesn't do but is on the immediate horizon:\r\n\r\n* Sort groups\r\n* Provide new attrs (`type`, e.g.)\r\n* Provide URL(s) for groups \r\n* Accept `document_url` parameter\r\n\r\nAs it is additive and new, the addition of this service and endpoint shouldn't interact or affect any other services or endpoints in the backend application.\r\n\r\nRelated to https://github.com/hypothesis/product-backlog/issues/450","created_at":"2018-01-31T16:30:10Z","updated_at":"2018-02-01T15:54:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f8a1649f9a4dd61f0476611f81d77c3056d6fa0b","assignee":{"login":"seanh","id":22498,"avatar_url":"https://avatars3.githubusercontent.com/u/22498?v=4","gravatar_id":"","url":"https://api.github.com/users/seanh","html_url":"https://github.com/seanh","followers_url":"https://api.github.com/users/seanh/followers","following_url":"https://api.github.com/users/seanh/following{/other_user}","gists_url":"https://api.github.com/users/seanh/gists{/gist_id}","starred_url":"https://api.github.com/users/seanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanh/subscriptions","organizations_url":"https://api.github.com/users/seanh/orgs","repos_url":"https://api.github.com/users/seanh/repos","events_url":"https://api.github.com/users/seanh/events{/privacy}","received_events_url":"https://api.github.com/users/seanh/received_events","type":"User","site_admin":false},"assignees":[{"login":"seanh","id":22498,"avatar_url":"https://avatars3.githubusercontent.com/u/22498?v=4","gravatar_id":"","url":"https://api.github.com/users/seanh","html_url":"https://github.com/seanh","followers_url":"https://api.github.com/users/seanh/followers","following_url":"https://api.github.com/users/seanh/following{/other_user}","gists_url":"https://api.github.com/users/seanh/gists{/gist_id}","starred_url":"https://api.github.com/users/seanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanh/subscriptions","organizations_url":"https://api.github.com/users/seanh/orgs","repos_url":"https://api.github.com/users/seanh/repos","events_url":"https://api.github.com/users/seanh/events{/privacy}","received_events_url":"https://api.github.com/users/seanh/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/hypothesis/h/pulls/4758/commits","review_comments_url":"https://api.github.com/repos/hypothesis/h/pulls/4758/comments","review_comment_url":"https://api.github.com/repos/hypothesis/h/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hypothesis/h/issues/4758/comments","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/4b3219ccfa6cd8865eeef47af5c2f1991eba42e8","head":{"label":"hypothesis:add-profile-groups","ref":"add-profile-groups","sha":"4b3219ccfa6cd8865eeef47af5c2f1991eba42e8","user":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars1.githubusercontent.com/u/1243215?v=4","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"repo":{"id":3910945,"name":"h","full_name":"hypothesis/h","owner":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars1.githubusercontent.com/u/1243215?v=4","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hypothesis/h","description":"Annotate with anyone, anywhere.","fork":false,"url":"https://api.github.com/repos/hypothesis/h","forks_url":"https://api.github.com/repos/hypothesis/h/forks","keys_url":"https://api.github.com/repos/hypothesis/h/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hypothesis/h/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hypothesis/h/teams","hooks_url":"https://api.github.com/repos/hypothesis/h/hooks","issue_events_url":"https://api.github.com/repos/hypothesis/h/issues/events{/number}","events_url":"https://api.github.com/repos/hypothesis/h/events","assignees_url":"https://api.github.com/repos/hypothesis/h/assignees{/user}","branches_url":"https://api.github.com/repos/hypothesis/h/branches{/branch}","tags_url":"https://api.github.com/repos/hypothesis/h/tags","blobs_url":"https://api.github.com/repos/hypothesis/h/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hypothesis/h/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hypothesis/h/git/refs{/sha}","trees_url":"https://api.github.com/repos/hypothesis/h/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/{sha}","languages_url":"https://api.github.com/repos/hypothesis/h/languages","stargazers_url":"https://api.github.com/repos/hypothesis/h/stargazers","contributors_url":"https://api.github.com/repos/hypothesis/h/contributors","subscribers_url":"https://api.github.com/repos/hypothesis/h/subscribers","subscription_url":"https://api.github.com/repos/hypothesis/h/subscription","commits_url":"https://api.github.com/repos/hypothesis/h/commits{/sha}","git_commits_url":"https://api.github.com/repos/hypothesis/h/git/commits{/sha}","comments_url":"https://api.github.com/repos/hypothesis/h/comments{/number}","issue_comment_url":"https://api.github.com/repos/hypothesis/h/issues/comments{/number}","contents_url":"https://api.github.com/repos/hypothesis/h/contents/{+path}","compare_url":"https://api.github.com/repos/hypothesis/h/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hypothesis/h/merges","archive_url":"https://api.github.com/repos/hypothesis/h/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hypothesis/h/downloads","issues_url":"https://api.github.com/repos/hypothesis/h/issues{/number}","pulls_url":"https://api.github.com/repos/hypothesis/h/pulls{/number}","milestones_url":"https://api.github.com/repos/hypothesis/h/milestones{/number}","notifications_url":"https://api.github.com/repos/hypothesis/h/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hypothesis/h/labels{/name}","releases_url":"https://api.github.com/repos/hypothesis/h/releases{/id}","deployments_url":"https://api.github.com/repos/hypothesis/h/deployments","created_at":"2012-04-02T19:56:59Z","updated_at":"2018-01-31T20:25:46Z","pushed_at":"2018-02-01T10:29:19Z","git_url":"git://github.com/hypothesis/h.git","ssh_url":"git@github.com:hypothesis/h.git","clone_url":"https://github.com/hypothesis/h.git","svn_url":"https://github.com/hypothesis/h","homepage":"https://hypothes.is/","size":28453,"stargazers_count":1013,"watchers_count":1013,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":234,"mirror_url":null,"archived":false,"open_issues_count":61,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":234,"open_issues":61,"watchers":1013,"default_branch":"master"}},"base":{"label":"hypothesis:master","ref":"master","sha":"4151f3111a862257fb046690fe415f6f9a21f59b","user":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars1.githubusercontent.com/u/1243215?v=4","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"repo":{"id":3910945,"name":"h","full_name":"hypothesis/h","owner":{"login":"hypothesis","id":1243215,"avatar_url":"https://avatars1.githubusercontent.com/u/1243215?v=4","gravatar_id":"","url":"https://api.github.com/users/hypothesis","html_url":"https://github.com/hypothesis","followers_url":"https://api.github.com/users/hypothesis/followers","following_url":"https://api.github.com/users/hypothesis/following{/other_user}","gists_url":"https://api.github.com/users/hypothesis/gists{/gist_id}","starred_url":"https://api.github.com/users/hypothesis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypothesis/subscriptions","organizations_url":"https://api.github.com/users/hypothesis/orgs","repos_url":"https://api.github.com/users/hypothesis/repos","events_url":"https://api.github.com/users/hypothesis/events{/privacy}","received_events_url":"https://api.github.com/users/hypothesis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hypothesis/h","description":"Annotate with anyone, anywhere.","fork":false,"url":"https://api.github.com/repos/hypothesis/h","forks_url":"https://api.github.com/repos/hypothesis/h/forks","keys_url":"https://api.github.com/repos/hypothesis/h/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hypothesis/h/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hypothesis/h/teams","hooks_url":"https://api.github.com/repos/hypothesis/h/hooks","issue_events_url":"https://api.github.com/repos/hypothesis/h/issues/events{/number}","events_url":"https://api.github.com/repos/hypothesis/h/events","assignees_url":"https://api.github.com/repos/hypothesis/h/assignees{/user}","branches_url":"https://api.github.com/repos/hypothesis/h/branches{/branch}","tags_url":"https://api.github.com/repos/hypothesis/h/tags","blobs_url":"https://api.github.com/repos/hypothesis/h/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hypothesis/h/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hypothesis/h/git/refs{/sha}","trees_url":"https://api.github.com/repos/hypothesis/h/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hypothesis/h/statuses/{sha}","languages_url":"https://api.github.com/repos/hypothesis/h/languages","stargazers_url":"https://api.github.com/repos/hypothesis/h/stargazers","contributors_url":"https://api.github.com/repos/hypothesis/h/contributors","subscribers_url":"https://api.github.com/repos/hypothesis/h/subscribers","subscription_url":"https://api.github.com/repos/hypothesis/h/subscription","commits_url":"https://api.github.com/repos/hypothesis/h/commits{/sha}","git_commits_url":"https://api.github.com/repos/hypothesis/h/git/commits{/sha}","comments_url":"https://api.github.com/repos/hypothesis/h/comments{/number}","issue_comment_url":"https://api.github.com/repos/hypothesis/h/issues/comments{/number}","contents_url":"https://api.github.com/repos/hypothesis/h/contents/{+path}","compare_url":"https://api.github.com/repos/hypothesis/h/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hypothesis/h/merges","archive_url":"https://api.github.com/repos/hypothesis/h/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hypothesis/h/downloads","issues_url":"https://api.github.com/repos/hypothesis/h/issues{/number}","pulls_url":"https://api.github.com/repos/hypothesis/h/pulls{/number}","milestones_url":"https://api.github.com/repos/hypothesis/h/milestones{/number}","notifications_url":"https://api.github.com/repos/hypothesis/h/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hypothesis/h/labels{/name}","releases_url":"https://api.github.com/repos/hypothesis/h/releases{/id}","deployments_url":"https://api.github.com/repos/hypothesis/h/deployments","created_at":"2012-04-02T19:56:59Z","updated_at":"2018-01-31T20:25:46Z","pushed_at":"2018-02-01T10:29:19Z","git_url":"git://github.com/hypothesis/h.git","ssh_url":"git@github.com:hypothesis/h.git","clone_url":"https://github.com/hypothesis/h.git","svn_url":"https://github.com/hypothesis/h","homepage":"https://hypothes.is/","size":28453,"stargazers_count":1013,"watchers_count":1013,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":234,"mirror_url":null,"archived":false,"open_issues_count":61,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":234,"open_issues":61,"watchers":1013,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hypothesis/h/pulls/4758"},"html":{"href":"https://github.com/hypothesis/h/pull/4758"},"issue":{"href":"https://api.github.com/repos/hypothesis/h/issues/4758"},"comments":{"href":"https://api.github.com/repos/hypothesis/h/issues/4758/comments"},"review_comments":{"href":"https://api.github.com/repos/hypothesis/h/pulls/4758/comments"},"review_comment":{"href":"https://api.github.com/repos/hypothesis/h/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hypothesis/h/pulls/4758/commits"},"statuses":{"href":"https://api.github.com/repos/hypothesis/h/statuses/4b3219ccfa6cd8865eeef47af5c2f1991eba42e8"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"lyzadanger"}}