{"action":"created","comment":{"url":"https://api.github.com/repos/cozy/cozy-stack/pulls/comments/184005027","pull_request_review_id":115106632,"id":184005027,"diff_hunk":"@@ -175,4 +175,31 @@ func GetSharedDocsBySharingID(inst *instance.Instance, sharingID string) ([]couc\n \treturn result, nil\n }\n \n+// GetSharingsByDocType returns the sharingids related to the\n+// given docType\n+func GetSharingsByDocType(inst *instance.Instance, docType string) ([]string, error) {\n+\tvar req = &couchdb.AllDocsRequest{\n+\t\tStartKey: docType + \"/\",\n+\t\tEndKey:   docType + \"/\\uFFFF\",\n+\t}\n+\n+\tvar docs []*SharedRef\n+\terr := couchdb.GetAllDocs(inst, consts.Shared, req, &docs)\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\t// Use a map to easily avoid duplicates\n+\tkeys := make(map[string]bool)\n+\tvar sharingIDs []string\n+\tfor _, doc := range docs {\n+\t\tfor id := range doc.Infos {","path":"pkg/sharing/shared.go","position":21,"original_position":21,"commit_id":"33acbfb9d34a516476b4e4cfbbbef77270a73db8","original_commit_id":"06789896072e61ee9f066e1bc30a041054f03bbf","user":{"login":"nono","id":2767,"avatar_url":"https://avatars3.githubusercontent.com/u/2767?v=4","gravatar_id":"","url":"https://api.github.com/users/nono","html_url":"https://github.com/nono","followers_url":"https://api.github.com/users/nono/followers","following_url":"https://api.github.com/users/nono/following{/other_user}","gists_url":"https://api.github.com/users/nono/gists{/gist_id}","starred_url":"https://api.github.com/users/nono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nono/subscriptions","organizations_url":"https://api.github.com/users/nono/orgs","repos_url":"https://api.github.com/users/nono/repos","events_url":"https://api.github.com/users/nono/events{/privacy}","received_events_url":"https://api.github.com/users/nono/received_events","type":"User","site_admin":false},"body":"You don't look at the `removed` flag of Infos, so the files/documents that have been removed/deleted/taken out of the sharing will be included. Is it what you want to do? The description of the endpoint is not really clear on that.\r\n\r\nI'd have not done like that, but both points of view can be defended.","created_at":"2018-04-25T10:04:56Z","updated_at":"2018-04-25T10:06:30Z","html_url":"https://github.com/cozy/cozy-stack/pull/1336#discussion_r184005027","pull_request_url":"https://api.github.com/repos/cozy/cozy-stack/pulls/1336","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/cozy/cozy-stack/pulls/comments/184005027"},"html":{"href":"https://github.com/cozy/cozy-stack/pull/1336#discussion_r184005027"},"pull_request":{"href":"https://api.github.com/repos/cozy/cozy-stack/pulls/1336"}}},"pull_request":{"url":"https://api.github.com/repos/cozy/cozy-stack/pulls/1336","id":181607677,"html_url":"https://github.com/cozy/cozy-stack/pull/1336","diff_url":"https://github.com/cozy/cozy-stack/pull/1336.diff","patch_url":"https://github.com/cozy/cozy-stack/pull/1336.patch","issue_url":"https://api.github.com/repos/cozy/cozy-stack/issues/1336","number":1336,"state":"open","locked":false,"title":"[WIP] Sharing get doctypes","user":{"login":"Gara64","id":7010087,"avatar_url":"https://avatars2.githubusercontent.com/u/7010087?v=4","gravatar_id":"","url":"https://api.github.com/users/Gara64","html_url":"https://github.com/Gara64","followers_url":"https://api.github.com/users/Gara64/followers","following_url":"https://api.github.com/users/Gara64/following{/other_user}","gists_url":"https://api.github.com/users/Gara64/gists{/gist_id}","starred_url":"https://api.github.com/users/Gara64/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gara64/subscriptions","organizations_url":"https://api.github.com/users/Gara64/orgs","repos_url":"https://api.github.com/users/Gara64/repos","events_url":"https://api.github.com/users/Gara64/events{/privacy}","received_events_url":"https://api.github.com/users/Gara64/received_events","type":"User","site_admin":false},"body":"This PR is based on #1333.\r\n\r\nThis is a naive implementation to get the the sharing info from a doctype. Actually, this will returns as many sharing info as there are a shared documents, i.e. a sharing involving 5 docs will be returned 5 times. We might use a smarter map function and/or a reduce.\r\n\r\nI am not confident on the json-api format either.","created_at":"2018-04-13T22:17:48Z","updated_at":"2018-04-25T10:06:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88415011bf4a4c7cbf5803ed0c3d34040d336f57","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/cozy/cozy-stack/pulls/1336/commits","review_comments_url":"https://api.github.com/repos/cozy/cozy-stack/pulls/1336/comments","review_comment_url":"https://api.github.com/repos/cozy/cozy-stack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cozy/cozy-stack/issues/1336/comments","statuses_url":"https://api.github.com/repos/cozy/cozy-stack/statuses/33acbfb9d34a516476b4e4cfbbbef77270a73db8","head":{"label":"Gara64:sharing_get_doctypes","ref":"sharing_get_doctypes","sha":"33acbfb9d34a516476b4e4cfbbbef77270a73db8","user":{"login":"Gara64","id":7010087,"avatar_url":"https://avatars2.githubusercontent.com/u/7010087?v=4","gravatar_id":"","url":"https://api.github.com/users/Gara64","html_url":"https://github.com/Gara64","followers_url":"https://api.github.com/users/Gara64/followers","following_url":"https://api.github.com/users/Gara64/following{/other_user}","gists_url":"https://api.github.com/users/Gara64/gists{/gist_id}","starred_url":"https://api.github.com/users/Gara64/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gara64/subscriptions","organizations_url":"https://api.github.com/users/Gara64/orgs","repos_url":"https://api.github.com/users/Gara64/repos","events_url":"https://api.github.com/users/Gara64/events{/privacy}","received_events_url":"https://api.github.com/users/Gara64/received_events","type":"User","site_admin":false},"repo":{"id":65031187,"name":"cozy-stack","full_name":"Gara64/cozy-stack","owner":{"login":"Gara64","id":7010087,"avatar_url":"https://avatars2.githubusercontent.com/u/7010087?v=4","gravatar_id":"","url":"https://api.github.com/users/Gara64","html_url":"https://github.com/Gara64","followers_url":"https://api.github.com/users/Gara64/followers","following_url":"https://api.github.com/users/Gara64/following{/other_user}","gists_url":"https://api.github.com/users/Gara64/gists{/gist_id}","starred_url":"https://api.github.com/users/Gara64/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gara64/subscriptions","organizations_url":"https://api.github.com/users/Gara64/orgs","repos_url":"https://api.github.com/users/Gara64/repos","events_url":"https://api.github.com/users/Gara64/events{/privacy}","received_events_url":"https://api.github.com/users/Gara64/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Gara64/cozy-stack","description":"Simple, Versatile, Yours","fork":true,"url":"https://api.github.com/repos/Gara64/cozy-stack","forks_url":"https://api.github.com/repos/Gara64/cozy-stack/forks","keys_url":"https://api.github.com/repos/Gara64/cozy-stack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Gara64/cozy-stack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Gara64/cozy-stack/teams","hooks_url":"https://api.github.com/repos/Gara64/cozy-stack/hooks","issue_events_url":"https://api.github.com/repos/Gara64/cozy-stack/issues/events{/number}","events_url":"https://api.github.com/repos/Gara64/cozy-stack/events","assignees_url":"https://api.github.com/repos/Gara64/cozy-stack/assignees{/user}","branches_url":"https://api.github.com/repos/Gara64/cozy-stack/branches{/branch}","tags_url":"https://api.github.com/repos/Gara64/cozy-stack/tags","blobs_url":"https://api.github.com/repos/Gara64/cozy-stack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Gara64/cozy-stack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Gara64/cozy-stack/git/refs{/sha}","trees_url":"https://api.github.com/repos/Gara64/cozy-stack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Gara64/cozy-stack/statuses/{sha}","languages_url":"https://api.github.com/repos/Gara64/cozy-stack/languages","stargazers_url":"https://api.github.com/repos/Gara64/cozy-stack/stargazers","contributors_url":"https://api.github.com/repos/Gara64/cozy-stack/contributors","subscribers_url":"https://api.github.com/repos/Gara64/cozy-stack/subscribers","subscription_url":"https://api.github.com/repos/Gara64/cozy-stack/subscription","commits_url":"https://api.github.com/repos/Gara64/cozy-stack/commits{/sha}","git_commits_url":"https://api.github.com/repos/Gara64/cozy-stack/git/commits{/sha}","comments_url":"https://api.github.com/repos/Gara64/cozy-stack/comments{/number}","issue_comment_url":"https://api.github.com/repos/Gara64/cozy-stack/issues/comments{/number}","contents_url":"https://api.github.com/repos/Gara64/cozy-stack/contents/{+path}","compare_url":"https://api.github.com/repos/Gara64/cozy-stack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Gara64/cozy-stack/merges","archive_url":"https://api.github.com/repos/Gara64/cozy-stack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Gara64/cozy-stack/downloads","issues_url":"https://api.github.com/repos/Gara64/cozy-stack/issues{/number}","pulls_url":"https://api.github.com/repos/Gara64/cozy-stack/pulls{/number}","milestones_url":"https://api.github.com/repos/Gara64/cozy-stack/milestones{/number}","notifications_url":"https://api.github.com/repos/Gara64/cozy-stack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Gara64/cozy-stack/labels{/name}","releases_url":"https://api.github.com/repos/Gara64/cozy-stack/releases{/id}","deployments_url":"https://api.github.com/repos/Gara64/cozy-stack/deployments","created_at":"2016-08-05T15:57:15Z","updated_at":"2016-08-05T15:57:16Z","pushed_at":"2018-04-25T09:19:10Z","git_url":"git://github.com/Gara64/cozy-stack.git","ssh_url":"git@github.com:Gara64/cozy-stack.git","clone_url":"https://github.com/Gara64/cozy-stack.git","svn_url":"https://github.com/Gara64/cozy-stack","homepage":"https://cozy.io","size":50789,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cozy:master","ref":"master","sha":"1abbada5ab8bd1fd28c8f8a4aa84cce0861b299c","user":{"login":"cozy","id":7690525,"avatar_url":"https://avatars0.githubusercontent.com/u/7690525?v=4","gravatar_id":"","url":"https://api.github.com/users/cozy","html_url":"https://github.com/cozy","followers_url":"https://api.github.com/users/cozy/followers","following_url":"https://api.github.com/users/cozy/following{/other_user}","gists_url":"https://api.github.com/users/cozy/gists{/gist_id}","starred_url":"https://api.github.com/users/cozy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cozy/subscriptions","organizations_url":"https://api.github.com/users/cozy/orgs","repos_url":"https://api.github.com/users/cozy/repos","events_url":"https://api.github.com/users/cozy/events{/privacy}","received_events_url":"https://api.github.com/users/cozy/received_events","type":"Organization","site_admin":false},"repo":{"id":63433838,"name":"cozy-stack","full_name":"cozy/cozy-stack","owner":{"login":"cozy","id":7690525,"avatar_url":"https://avatars0.githubusercontent.com/u/7690525?v=4","gravatar_id":"","url":"https://api.github.com/users/cozy","html_url":"https://github.com/cozy","followers_url":"https://api.github.com/users/cozy/followers","following_url":"https://api.github.com/users/cozy/following{/other_user}","gists_url":"https://api.github.com/users/cozy/gists{/gist_id}","starred_url":"https://api.github.com/users/cozy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cozy/subscriptions","organizations_url":"https://api.github.com/users/cozy/orgs","repos_url":"https://api.github.com/users/cozy/repos","events_url":"https://api.github.com/users/cozy/events{/privacy}","received_events_url":"https://api.github.com/users/cozy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cozy/cozy-stack","description":"Simple, Versatile, Yours","fork":false,"url":"https://api.github.com/repos/cozy/cozy-stack","forks_url":"https://api.github.com/repos/cozy/cozy-stack/forks","keys_url":"https://api.github.com/repos/cozy/cozy-stack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cozy/cozy-stack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cozy/cozy-stack/teams","hooks_url":"https://api.github.com/repos/cozy/cozy-stack/hooks","issue_events_url":"https://api.github.com/repos/cozy/cozy-stack/issues/events{/number}","events_url":"https://api.github.com/repos/cozy/cozy-stack/events","assignees_url":"https://api.github.com/repos/cozy/cozy-stack/assignees{/user}","branches_url":"https://api.github.com/repos/cozy/cozy-stack/branches{/branch}","tags_url":"https://api.github.com/repos/cozy/cozy-stack/tags","blobs_url":"https://api.github.com/repos/cozy/cozy-stack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cozy/cozy-stack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cozy/cozy-stack/git/refs{/sha}","trees_url":"https://api.github.com/repos/cozy/cozy-stack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cozy/cozy-stack/statuses/{sha}","languages_url":"https://api.github.com/repos/cozy/cozy-stack/languages","stargazers_url":"https://api.github.com/repos/cozy/cozy-stack/stargazers","contributors_url":"https://api.github.com/repos/cozy/cozy-stack/contributors","subscribers_url":"https://api.github.com/repos/cozy/cozy-stack/subscribers","subscription_url":"https://api.github.com/repos/cozy/cozy-stack/subscription","commits_url":"https://api.github.com/repos/cozy/cozy-stack/commits{/sha}","git_commits_url":"https://api.github.com/repos/cozy/cozy-stack/git/commits{/sha}","comments_url":"https://api.github.com/repos/cozy/cozy-stack/comments{/number}","issue_comment_url":"https://api.github.com/repos/cozy/cozy-stack/issues/comments{/number}","contents_url":"https://api.github.com/repos/cozy/cozy-stack/contents/{+path}","compare_url":"https://api.github.com/repos/cozy/cozy-stack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cozy/cozy-stack/merges","archive_url":"https://api.github.com/repos/cozy/cozy-stack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cozy/cozy-stack/downloads","issues_url":"https://api.github.com/repos/cozy/cozy-stack/issues{/number}","pulls_url":"https://api.github.com/repos/cozy/cozy-stack/pulls{/number}","milestones_url":"https://api.github.com/repos/cozy/cozy-stack/milestones{/number}","notifications_url":"https://api.github.com/repos/cozy/cozy-stack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cozy/cozy-stack/labels{/name}","releases_url":"https://api.github.com/repos/cozy/cozy-stack/releases{/id}","deployments_url":"https://api.github.com/repos/cozy/cozy-stack/deployments","created_at":"2016-07-15T15:54:30Z","updated_at":"2018-04-24T21:15:44Z","pushed_at":"2018-04-25T09:19:12Z","git_url":"git://github.com/cozy/cozy-stack.git","ssh_url":"git@github.com:cozy/cozy-stack.git","clone_url":"https://github.com/cozy/cozy-stack.git","svn_url":"https://github.com/cozy/cozy-stack","homepage":"https://cozy.github.io/cozy-stack/","size":50802,"stargazers_count":319,"watchers_count":319,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":63,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":63,"open_issues":9,"watchers":319,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cozy/cozy-stack/pulls/1336"},"html":{"href":"https://github.com/cozy/cozy-stack/pull/1336"},"issue":{"href":"https://api.github.com/repos/cozy/cozy-stack/issues/1336"},"comments":{"href":"https://api.github.com/repos/cozy/cozy-stack/issues/1336/comments"},"review_comments":{"href":"https://api.github.com/repos/cozy/cozy-stack/pulls/1336/comments"},"review_comment":{"href":"https://api.github.com/repos/cozy/cozy-stack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cozy/cozy-stack/pulls/1336/commits"},"statuses":{"href":"https://api.github.com/repos/cozy/cozy-stack/statuses/33acbfb9d34a516476b4e4cfbbbef77270a73db8"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nono"}}