{"action":"created","comment":{"url":"https://api.github.com/repos/learningequality/kolibri/pulls/comments/180839272","pull_request_review_id":111332697,"id":180839272,"diff_hunk":"@@ -222,6 +223,20 @@ def filter_kind(self, queryset, name, value):\n             return queryset.exclude(kind=content_kinds.TOPIC).order_by(\"lft\")\n         return queryset.filter(kind=value).order_by(\"lft\")\n \n+    def filter_by_role(self, queryset, name, value):\n+        \"\"\"\n+        Show coach_content if they have coach role or higher.\n+\n+        :param queryset: all content nodes for this channel\n+        :param value: 'boolean'\n+        :return: content nodes filtered by coach_content if appropiate\n+        \"\"\"\n+        user = self.request.user\n+        if user.is_facility_user:  # exclude anon users\n+            if user.roles.exists() or user.is_superuser:  # must have coach role or higher\n+                return queryset\n+        return queryset.exclude(coach_content=True)","path":"kolibri/content/api.py","position":24,"original_position":24,"commit_id":"3225eabe5a8ea1077455a7f0961918275c422c7f","original_commit_id":"3225eabe5a8ea1077455a7f0961918275c422c7f","user":{"login":"jonboiser","id":10248067,"avatar_url":"https://avatars2.githubusercontent.com/u/10248067?v=4","gravatar_id":"","url":"https://api.github.com/users/jonboiser","html_url":"https://github.com/jonboiser","followers_url":"https://api.github.com/users/jonboiser/followers","following_url":"https://api.github.com/users/jonboiser/following{/other_user}","gists_url":"https://api.github.com/users/jonboiser/gists{/gist_id}","starred_url":"https://api.github.com/users/jonboiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonboiser/subscriptions","organizations_url":"https://api.github.com/users/jonboiser/orgs","repos_url":"https://api.github.com/users/jonboiser/repos","events_url":"https://api.github.com/users/jonboiser/events{/privacy}","received_events_url":"https://api.github.com/users/jonboiser/received_events","type":"User","site_admin":false},"body":"@jayoshih This might lead to unexpected behavior on hand-annotated Channels like firki. My understanding is that Topics should not have `coach_content == True`, which is the case for Firki. So this user would not be able to see this topic, even if it did have non coach-content stuff in it.","created_at":"2018-04-11T17:40:34Z","updated_at":"2018-04-11T17:40:35Z","html_url":"https://github.com/learningequality/kolibri/pull/3489#discussion_r180839272","pull_request_url":"https://api.github.com/repos/learningequality/kolibri/pulls/3489","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/learningequality/kolibri/pulls/comments/180839272"},"html":{"href":"https://github.com/learningequality/kolibri/pull/3489#discussion_r180839272"},"pull_request":{"href":"https://api.github.com/repos/learningequality/kolibri/pulls/3489"}}},"pull_request":{"url":"https://api.github.com/repos/learningequality/kolibri/pulls/3489","id":180070969,"html_url":"https://github.com/learningequality/kolibri/pull/3489","diff_url":"https://github.com/learningequality/kolibri/pull/3489.diff","patch_url":"https://github.com/learningequality/kolibri/pull/3489.patch","issue_url":"https://api.github.com/repos/learningequality/kolibri/issues/3489","number":3489,"state":"open","locked":false,"title":"Coach content filter","user":{"login":"ralphiee22","id":6361732,"avatar_url":"https://avatars3.githubusercontent.com/u/6361732?v=4","gravatar_id":"","url":"https://api.github.com/users/ralphiee22","html_url":"https://github.com/ralphiee22","followers_url":"https://api.github.com/users/ralphiee22/followers","following_url":"https://api.github.com/users/ralphiee22/following{/other_user}","gists_url":"https://api.github.com/users/ralphiee22/gists{/gist_id}","starred_url":"https://api.github.com/users/ralphiee22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralphiee22/subscriptions","organizations_url":"https://api.github.com/users/ralphiee22/orgs","repos_url":"https://api.github.com/users/ralphiee22/repos","events_url":"https://api.github.com/users/ralphiee22/events{/privacy}","received_events_url":"https://api.github.com/users/ralphiee22/received_events","type":"User","site_admin":false},"body":"<!--\r\n 1. Following guidance below, replace …'s with your own words\r\n 2. After saving the PR, tick of completed checklist items\r\n 3. Skip checklist items that are not applicable or not necessary\r\n 4. Delete instruction/comment blocks\r\n-->\r\n\r\n### Summary\r\n<!--\r\n * description of the change\r\n * manual verification steps performed\r\n * screenshots if the PR affects the UI\r\n-->\r\n\r\nContent items are now filtered by whether they are meant for coaches/teachers or not.\r\n\r\n### Reviewer guidance\r\n<!--\r\n * how can a reviewer test these changes?\r\n * are there any risky areas that deserve extra testing\r\n-->\r\n\r\n_**Frontend**_: Download a channel that has coach content, log in as learner, should not be able to see said content.\r\n**_Backend_**: run the tests!\r\n\r\n### References\r\n<!--\r\n * references to related issues and PRs\r\n * links to mockups or specs for new features\r\n * links to the diffs for any dependency updates, e.g. in iceqube or the perseus plugin\r\n-->\r\n\r\n…\r\n\r\n----\r\n\r\n### Contributor Checklist\r\n\r\n- [x] Contributor has fully tested the PR manually\r\n- [x] PR has the correct target branch and milestone\r\n- [x] PR has 'needs review' or 'work-in-progress' label\r\n- [x] If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')\r\n- [x] If there are any front-end changes, before/after screenshots are included\r\n- [x] If this is an important user-facing change, PR or related issue has a 'changelog' label\r\n\r\n### Reviewer Checklist\r\n\r\n- [ ] Automated test coverage is satisfactory\r\n- [ ] Reviewer has fully tested the PR manually\r\n- [ ] PR has been tested for [accessibility regressions](http://kolibri-dev.readthedocs.io/en/develop/manual_testing.html#accessibility-a11y-testing)\r\n- [ ] External dependencies files were updated (`yarn` and `pip`)\r\n- [ ] Documentation is updated\r\n- [ ] Link to diff of internal dependency change is included\r\n- [ ] CHANGELOG.rst is updated for high-level changes\r\n- [ ] Contributor is in AUTHORS.rst\r\n","created_at":"2018-04-06T22:54:10Z","updated_at":"2018-04-11T17:40:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"99753f0685e6e92325a87ffdbd4b5eb98b90afe4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":410338552,"url":"https://api.github.com/repos/learningequality/kolibri/labels/PR:%20needs%20review","name":"PR: needs review","color":"1f6ad6","default":false}],"milestone":{"url":"https://api.github.com/repos/learningequality/kolibri/milestones/18","html_url":"https://github.com/learningequality/kolibri/milestone/18","labels_url":"https://api.github.com/repos/learningequality/kolibri/milestones/18/labels","id":3097289,"number":18,"title":"0.10.0","description":"","creator":{"login":"indirectlylit","id":2367265,"avatar_url":"https://avatars2.githubusercontent.com/u/2367265?v=4","gravatar_id":"","url":"https://api.github.com/users/indirectlylit","html_url":"https://github.com/indirectlylit","followers_url":"https://api.github.com/users/indirectlylit/followers","following_url":"https://api.github.com/users/indirectlylit/following{/other_user}","gists_url":"https://api.github.com/users/indirectlylit/gists{/gist_id}","starred_url":"https://api.github.com/users/indirectlylit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indirectlylit/subscriptions","organizations_url":"https://api.github.com/users/indirectlylit/orgs","repos_url":"https://api.github.com/users/indirectlylit/repos","events_url":"https://api.github.com/users/indirectlylit/events{/privacy}","received_events_url":"https://api.github.com/users/indirectlylit/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":19,"state":"open","created_at":"2018-02-07T17:08:38Z","updated_at":"2018-04-11T00:50:08Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/learningequality/kolibri/pulls/3489/commits","review_comments_url":"https://api.github.com/repos/learningequality/kolibri/pulls/3489/comments","review_comment_url":"https://api.github.com/repos/learningequality/kolibri/pulls/comments{/number}","comments_url":"https://api.github.com/repos/learningequality/kolibri/issues/3489/comments","statuses_url":"https://api.github.com/repos/learningequality/kolibri/statuses/3225eabe5a8ea1077455a7f0961918275c422c7f","head":{"label":"ralphiee22:coach_content_filter","ref":"coach_content_filter","sha":"3225eabe5a8ea1077455a7f0961918275c422c7f","user":{"login":"ralphiee22","id":6361732,"avatar_url":"https://avatars3.githubusercontent.com/u/6361732?v=4","gravatar_id":"","url":"https://api.github.com/users/ralphiee22","html_url":"https://github.com/ralphiee22","followers_url":"https://api.github.com/users/ralphiee22/followers","following_url":"https://api.github.com/users/ralphiee22/following{/other_user}","gists_url":"https://api.github.com/users/ralphiee22/gists{/gist_id}","starred_url":"https://api.github.com/users/ralphiee22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralphiee22/subscriptions","organizations_url":"https://api.github.com/users/ralphiee22/orgs","repos_url":"https://api.github.com/users/ralphiee22/repos","events_url":"https://api.github.com/users/ralphiee22/events{/privacy}","received_events_url":"https://api.github.com/users/ralphiee22/received_events","type":"User","site_admin":false},"repo":{"id":61658796,"name":"kolibri","full_name":"ralphiee22/kolibri","owner":{"login":"ralphiee22","id":6361732,"avatar_url":"https://avatars3.githubusercontent.com/u/6361732?v=4","gravatar_id":"","url":"https://api.github.com/users/ralphiee22","html_url":"https://github.com/ralphiee22","followers_url":"https://api.github.com/users/ralphiee22/followers","following_url":"https://api.github.com/users/ralphiee22/following{/other_user}","gists_url":"https://api.github.com/users/ralphiee22/gists{/gist_id}","starred_url":"https://api.github.com/users/ralphiee22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralphiee22/subscriptions","organizations_url":"https://api.github.com/users/ralphiee22/orgs","repos_url":"https://api.github.com/users/ralphiee22/repos","events_url":"https://api.github.com/users/ralphiee22/events{/privacy}","received_events_url":"https://api.github.com/users/ralphiee22/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ralphiee22/kolibri","description":"This is where Kolibri shall be born, watch and participate!","fork":true,"url":"https://api.github.com/repos/ralphiee22/kolibri","forks_url":"https://api.github.com/repos/ralphiee22/kolibri/forks","keys_url":"https://api.github.com/repos/ralphiee22/kolibri/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ralphiee22/kolibri/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ralphiee22/kolibri/teams","hooks_url":"https://api.github.com/repos/ralphiee22/kolibri/hooks","issue_events_url":"https://api.github.com/repos/ralphiee22/kolibri/issues/events{/number}","events_url":"https://api.github.com/repos/ralphiee22/kolibri/events","assignees_url":"https://api.github.com/repos/ralphiee22/kolibri/assignees{/user}","branches_url":"https://api.github.com/repos/ralphiee22/kolibri/branches{/branch}","tags_url":"https://api.github.com/repos/ralphiee22/kolibri/tags","blobs_url":"https://api.github.com/repos/ralphiee22/kolibri/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ralphiee22/kolibri/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ralphiee22/kolibri/git/refs{/sha}","trees_url":"https://api.github.com/repos/ralphiee22/kolibri/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ralphiee22/kolibri/statuses/{sha}","languages_url":"https://api.github.com/repos/ralphiee22/kolibri/languages","stargazers_url":"https://api.github.com/repos/ralphiee22/kolibri/stargazers","contributors_url":"https://api.github.com/repos/ralphiee22/kolibri/contributors","subscribers_url":"https://api.github.com/repos/ralphiee22/kolibri/subscribers","subscription_url":"https://api.github.com/repos/ralphiee22/kolibri/subscription","commits_url":"https://api.github.com/repos/ralphiee22/kolibri/commits{/sha}","git_commits_url":"https://api.github.com/repos/ralphiee22/kolibri/git/commits{/sha}","comments_url":"https://api.github.com/repos/ralphiee22/kolibri/comments{/number}","issue_comment_url":"https://api.github.com/repos/ralphiee22/kolibri/issues/comments{/number}","contents_url":"https://api.github.com/repos/ralphiee22/kolibri/contents/{+path}","compare_url":"https://api.github.com/repos/ralphiee22/kolibri/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ralphiee22/kolibri/merges","archive_url":"https://api.github.com/repos/ralphiee22/kolibri/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ralphiee22/kolibri/downloads","issues_url":"https://api.github.com/repos/ralphiee22/kolibri/issues{/number}","pulls_url":"https://api.github.com/repos/ralphiee22/kolibri/pulls{/number}","milestones_url":"https://api.github.com/repos/ralphiee22/kolibri/milestones{/number}","notifications_url":"https://api.github.com/repos/ralphiee22/kolibri/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ralphiee22/kolibri/labels{/name}","releases_url":"https://api.github.com/repos/ralphiee22/kolibri/releases{/id}","deployments_url":"https://api.github.com/repos/ralphiee22/kolibri/deployments","created_at":"2016-06-21T18:50:35Z","updated_at":"2016-06-21T18:50:36Z","pushed_at":"2018-04-11T16:37:37Z","git_url":"git://github.com/ralphiee22/kolibri.git","ssh_url":"git@github.com:ralphiee22/kolibri.git","clone_url":"https://github.com/ralphiee22/kolibri.git","svn_url":"https://github.com/ralphiee22/kolibri","homepage":"http://learningequality.org/kolibri/","size":37112,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"learningequality:develop","ref":"develop","sha":"bbdd9851f332f91a3689f0909d43cc58a613ce7a","user":{"login":"learningequality","id":3926525,"avatar_url":"https://avatars1.githubusercontent.com/u/3926525?v=4","gravatar_id":"","url":"https://api.github.com/users/learningequality","html_url":"https://github.com/learningequality","followers_url":"https://api.github.com/users/learningequality/followers","following_url":"https://api.github.com/users/learningequality/following{/other_user}","gists_url":"https://api.github.com/users/learningequality/gists{/gist_id}","starred_url":"https://api.github.com/users/learningequality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/learningequality/subscriptions","organizations_url":"https://api.github.com/users/learningequality/orgs","repos_url":"https://api.github.com/users/learningequality/repos","events_url":"https://api.github.com/users/learningequality/events{/privacy}","received_events_url":"https://api.github.com/users/learningequality/received_events","type":"Organization","site_admin":false},"repo":{"id":49976939,"name":"kolibri","full_name":"learningequality/kolibri","owner":{"login":"learningequality","id":3926525,"avatar_url":"https://avatars1.githubusercontent.com/u/3926525?v=4","gravatar_id":"","url":"https://api.github.com/users/learningequality","html_url":"https://github.com/learningequality","followers_url":"https://api.github.com/users/learningequality/followers","following_url":"https://api.github.com/users/learningequality/following{/other_user}","gists_url":"https://api.github.com/users/learningequality/gists{/gist_id}","starred_url":"https://api.github.com/users/learningequality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/learningequality/subscriptions","organizations_url":"https://api.github.com/users/learningequality/orgs","repos_url":"https://api.github.com/users/learningequality/repos","events_url":"https://api.github.com/users/learningequality/events{/privacy}","received_events_url":"https://api.github.com/users/learningequality/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/learningequality/kolibri","description":"Kolibri: the offline app for universal education","fork":false,"url":"https://api.github.com/repos/learningequality/kolibri","forks_url":"https://api.github.com/repos/learningequality/kolibri/forks","keys_url":"https://api.github.com/repos/learningequality/kolibri/keys{/key_id}","collaborators_url":"https://api.github.com/repos/learningequality/kolibri/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/learningequality/kolibri/teams","hooks_url":"https://api.github.com/repos/learningequality/kolibri/hooks","issue_events_url":"https://api.github.com/repos/learningequality/kolibri/issues/events{/number}","events_url":"https://api.github.com/repos/learningequality/kolibri/events","assignees_url":"https://api.github.com/repos/learningequality/kolibri/assignees{/user}","branches_url":"https://api.github.com/repos/learningequality/kolibri/branches{/branch}","tags_url":"https://api.github.com/repos/learningequality/kolibri/tags","blobs_url":"https://api.github.com/repos/learningequality/kolibri/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/learningequality/kolibri/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/learningequality/kolibri/git/refs{/sha}","trees_url":"https://api.github.com/repos/learningequality/kolibri/git/trees{/sha}","statuses_url":"https://api.github.com/repos/learningequality/kolibri/statuses/{sha}","languages_url":"https://api.github.com/repos/learningequality/kolibri/languages","stargazers_url":"https://api.github.com/repos/learningequality/kolibri/stargazers","contributors_url":"https://api.github.com/repos/learningequality/kolibri/contributors","subscribers_url":"https://api.github.com/repos/learningequality/kolibri/subscribers","subscription_url":"https://api.github.com/repos/learningequality/kolibri/subscription","commits_url":"https://api.github.com/repos/learningequality/kolibri/commits{/sha}","git_commits_url":"https://api.github.com/repos/learningequality/kolibri/git/commits{/sha}","comments_url":"https://api.github.com/repos/learningequality/kolibri/comments{/number}","issue_comment_url":"https://api.github.com/repos/learningequality/kolibri/issues/comments{/number}","contents_url":"https://api.github.com/repos/learningequality/kolibri/contents/{+path}","compare_url":"https://api.github.com/repos/learningequality/kolibri/compare/{base}...{head}","merges_url":"https://api.github.com/repos/learningequality/kolibri/merges","archive_url":"https://api.github.com/repos/learningequality/kolibri/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/learningequality/kolibri/downloads","issues_url":"https://api.github.com/repos/learningequality/kolibri/issues{/number}","pulls_url":"https://api.github.com/repos/learningequality/kolibri/pulls{/number}","milestones_url":"https://api.github.com/repos/learningequality/kolibri/milestones{/number}","notifications_url":"https://api.github.com/repos/learningequality/kolibri/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/learningequality/kolibri/labels{/name}","releases_url":"https://api.github.com/repos/learningequality/kolibri/releases{/id}","deployments_url":"https://api.github.com/repos/learningequality/kolibri/deployments","created_at":"2016-01-19T19:22:07Z","updated_at":"2018-04-11T16:53:05Z","pushed_at":"2018-04-11T16:53:01Z","git_url":"git://github.com/learningequality/kolibri.git","ssh_url":"git@github.com:learningequality/kolibri.git","clone_url":"https://github.com/learningequality/kolibri.git","svn_url":"https://github.com/learningequality/kolibri","homepage":"http://learningequality.org/kolibri/","size":37263,"stargazers_count":159,"watchers_count":159,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":123,"mirror_url":null,"archived":false,"open_issues_count":242,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":123,"open_issues":242,"watchers":159,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/learningequality/kolibri/pulls/3489"},"html":{"href":"https://github.com/learningequality/kolibri/pull/3489"},"issue":{"href":"https://api.github.com/repos/learningequality/kolibri/issues/3489"},"comments":{"href":"https://api.github.com/repos/learningequality/kolibri/issues/3489/comments"},"review_comments":{"href":"https://api.github.com/repos/learningequality/kolibri/pulls/3489/comments"},"review_comment":{"href":"https://api.github.com/repos/learningequality/kolibri/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/learningequality/kolibri/pulls/3489/commits"},"statuses":{"href":"https://api.github.com/repos/learningequality/kolibri/statuses/3225eabe5a8ea1077455a7f0961918275c422c7f"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jonboiser"}}