{"action":"closed","number":1130,"pull_request":{"url":"https://api.github.com/repos/superdesk/superdesk/pulls/1130","id":44903942,"html_url":"https://github.com/superdesk/superdesk/pull/1130","diff_url":"https://github.com/superdesk/superdesk/pull/1130.diff","patch_url":"https://github.com/superdesk/superdesk/pull/1130.patch","issue_url":"https://api.github.com/repos/superdesk/superdesk/issues/1130","number":1130,"state":"closed","locked":false,"title":"Unify ingest Routing Filters and Publish Filters into Content Filters","user":{"login":"plamut","id":1235663,"avatar_url":"https://avatars.githubusercontent.com/u/1235663?v=3","gravatar_id":"","url":"https://api.github.com/users/plamut","html_url":"https://github.com/plamut","followers_url":"https://api.github.com/users/plamut/followers","following_url":"https://api.github.com/users/plamut/following{/other_user}","gists_url":"https://api.github.com/users/plamut/gists{/gist_id}","starred_url":"https://api.github.com/users/plamut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plamut/subscriptions","organizations_url":"https://api.github.com/users/plamut/orgs","repos_url":"https://api.github.com/users/plamut/repos","events_url":"https://api.github.com/users/plamut/events{/privacy}","received_events_url":"https://api.github.com/users/plamut/received_events","type":"User","site_admin":false},"body":"Resolves [SD-3136](https://dev.sourcefabric.org/browse/SD-3136).\r\n\r\nThis pull requests creates a new content type called Content Filters, which can be used for, well, filtering content. The main change is that these filters are now decoupled from the actions the system can take based on them, meaning that the same content filter can be used for publish filtering and ingest routing, for instance.\r\n\r\nThe existing publish filters have been moved into its own app, renamed to Content Filters, and placed under a new tab in Settings.\r\n\r\n**Refactoring steps:**\r\n* [x] move ex- Publish Filters to its own content type Content Filters\r\n* [x] move Content Filter setting under its own tab in Settings\r\n* [x] refactor Publishing to use the new Content Filters instead of the old Publish Filters\r\n* [x] refactor ingest routing to use the new Content Filters\r\n* [x] misc. cleanup\r\n* [x] NEW: Prevent deleting a content filter if it is referenced by at least one subscriber and/or routing rule.\r\n* [x] NEW: Add additional checks (if needed) in routing and publishing when acting upon a content filter, because it might have been deleted during the operation.\r\n\r\n**Sidenotes:**\r\n* This will most likely break the existing publish filters and routing rules. Since no DB migration script is planned, care must be taken when merging this in order to not break any instances meant for e.g. showcasing.\r\n* Content Filters are, for the most part, just the old Publish Filters code moved to a new place and adjusted a bit. A few minor bugs have been discovered and fixed along the way, but in general any bugs that migh have existed in the old code are probably still present in the new code - the test coverage wasn't that great and writing new tests to cover everything is outside the scope of this PR.\r\n* For some reason, loading the `superdesk.content_filters` module in tests fails to load due to a _\"Unknown provider: superdeskProvider\"_ error. This happens if any taste case uses the `inject()` function. Seems like something needs to be fixed in config, but for now declaring the `superdesk.publish` module as a dependency is a reasonable workaround, even though it is not strictly necessary.","created_at":"2015-09-14T08:26:16Z","updated_at":"2015-09-24T08:13:08Z","closed_at":"2015-09-24T08:13:08Z","merged_at":"2015-09-24T08:13:08Z","merge_commit_sha":"9b164fd1075dacbdb4d79b0b79a4167f9ece834e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/superdesk/superdesk/pulls/1130/commits","review_comments_url":"https://api.github.com/repos/superdesk/superdesk/pulls/1130/comments","review_comment_url":"https://api.github.com/repos/superdesk/superdesk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/superdesk/superdesk/issues/1130/comments","statuses_url":"https://api.github.com/repos/superdesk/superdesk/statuses/79511bf5f91b34514d46148bbc6fa1ce55b5bebf","head":{"label":"plamut:sd-3136","ref":"sd-3136","sha":"79511bf5f91b34514d46148bbc6fa1ce55b5bebf","user":{"login":"plamut","id":1235663,"avatar_url":"https://avatars.githubusercontent.com/u/1235663?v=3","gravatar_id":"","url":"https://api.github.com/users/plamut","html_url":"https://github.com/plamut","followers_url":"https://api.github.com/users/plamut/followers","following_url":"https://api.github.com/users/plamut/following{/other_user}","gists_url":"https://api.github.com/users/plamut/gists{/gist_id}","starred_url":"https://api.github.com/users/plamut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plamut/subscriptions","organizations_url":"https://api.github.com/users/plamut/orgs","repos_url":"https://api.github.com/users/plamut/repos","events_url":"https://api.github.com/users/plamut/events{/privacy}","received_events_url":"https://api.github.com/users/plamut/received_events","type":"User","site_admin":false},"repo":{"id":30860876,"name":"superdesk","full_name":"plamut/superdesk","owner":{"login":"plamut","id":1235663,"avatar_url":"https://avatars.githubusercontent.com/u/1235663?v=3","gravatar_id":"","url":"https://api.github.com/users/plamut","html_url":"https://github.com/plamut","followers_url":"https://api.github.com/users/plamut/followers","following_url":"https://api.github.com/users/plamut/following{/other_user}","gists_url":"https://api.github.com/users/plamut/gists{/gist_id}","starred_url":"https://api.github.com/users/plamut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plamut/subscriptions","organizations_url":"https://api.github.com/users/plamut/orgs","repos_url":"https://api.github.com/users/plamut/repos","events_url":"https://api.github.com/users/plamut/events{/privacy}","received_events_url":"https://api.github.com/users/plamut/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/plamut/superdesk","description":"","fork":true,"url":"https://api.github.com/repos/plamut/superdesk","forks_url":"https://api.github.com/repos/plamut/superdesk/forks","keys_url":"https://api.github.com/repos/plamut/superdesk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plamut/superdesk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plamut/superdesk/teams","hooks_url":"https://api.github.com/repos/plamut/superdesk/hooks","issue_events_url":"https://api.github.com/repos/plamut/superdesk/issues/events{/number}","events_url":"https://api.github.com/repos/plamut/superdesk/events","assignees_url":"https://api.github.com/repos/plamut/superdesk/assignees{/user}","branches_url":"https://api.github.com/repos/plamut/superdesk/branches{/branch}","tags_url":"https://api.github.com/repos/plamut/superdesk/tags","blobs_url":"https://api.github.com/repos/plamut/superdesk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plamut/superdesk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plamut/superdesk/git/refs{/sha}","trees_url":"https://api.github.com/repos/plamut/superdesk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plamut/superdesk/statuses/{sha}","languages_url":"https://api.github.com/repos/plamut/superdesk/languages","stargazers_url":"https://api.github.com/repos/plamut/superdesk/stargazers","contributors_url":"https://api.github.com/repos/plamut/superdesk/contributors","subscribers_url":"https://api.github.com/repos/plamut/superdesk/subscribers","subscription_url":"https://api.github.com/repos/plamut/superdesk/subscription","commits_url":"https://api.github.com/repos/plamut/superdesk/commits{/sha}","git_commits_url":"https://api.github.com/repos/plamut/superdesk/git/commits{/sha}","comments_url":"https://api.github.com/repos/plamut/superdesk/comments{/number}","issue_comment_url":"https://api.github.com/repos/plamut/superdesk/issues/comments{/number}","contents_url":"https://api.github.com/repos/plamut/superdesk/contents/{+path}","compare_url":"https://api.github.com/repos/plamut/superdesk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plamut/superdesk/merges","archive_url":"https://api.github.com/repos/plamut/superdesk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plamut/superdesk/downloads","issues_url":"https://api.github.com/repos/plamut/superdesk/issues{/number}","pulls_url":"https://api.github.com/repos/plamut/superdesk/pulls{/number}","milestones_url":"https://api.github.com/repos/plamut/superdesk/milestones{/number}","notifications_url":"https://api.github.com/repos/plamut/superdesk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plamut/superdesk/labels{/name}","releases_url":"https://api.github.com/repos/plamut/superdesk/releases{/id}","created_at":"2015-02-16T09:09:52Z","updated_at":"2015-09-01T12:43:31Z","pushed_at":"2015-09-24T05:42:03Z","git_url":"git://github.com/plamut/superdesk.git","ssh_url":"git@github.com:plamut/superdesk.git","clone_url":"https://github.com/plamut/superdesk.git","svn_url":"https://github.com/plamut/superdesk","homepage":null,"size":58019,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":0,"default_branch":"master"}},"base":{"label":"superdesk:master","ref":"master","sha":"46ee6e5f39f8d1f647663bb4ef755c18751c368e","user":{"login":"superdesk","id":5527298,"avatar_url":"https://avatars.githubusercontent.com/u/5527298?v=3","gravatar_id":"","url":"https://api.github.com/users/superdesk","html_url":"https://github.com/superdesk","followers_url":"https://api.github.com/users/superdesk/followers","following_url":"https://api.github.com/users/superdesk/following{/other_user}","gists_url":"https://api.github.com/users/superdesk/gists{/gist_id}","starred_url":"https://api.github.com/users/superdesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superdesk/subscriptions","organizations_url":"https://api.github.com/users/superdesk/orgs","repos_url":"https://api.github.com/users/superdesk/repos","events_url":"https://api.github.com/users/superdesk/events{/privacy}","received_events_url":"https://api.github.com/users/superdesk/received_events","type":"Organization","site_admin":false},"repo":{"id":23570030,"name":"superdesk","full_name":"superdesk/superdesk","owner":{"login":"superdesk","id":5527298,"avatar_url":"https://avatars.githubusercontent.com/u/5527298?v=3","gravatar_id":"","url":"https://api.github.com/users/superdesk","html_url":"https://github.com/superdesk","followers_url":"https://api.github.com/users/superdesk/followers","following_url":"https://api.github.com/users/superdesk/following{/other_user}","gists_url":"https://api.github.com/users/superdesk/gists{/gist_id}","starred_url":"https://api.github.com/users/superdesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superdesk/subscriptions","organizations_url":"https://api.github.com/users/superdesk/orgs","repos_url":"https://api.github.com/users/superdesk/repos","events_url":"https://api.github.com/users/superdesk/events{/privacy}","received_events_url":"https://api.github.com/users/superdesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/superdesk/superdesk","description":"The open source end-to-end news platform.","fork":false,"url":"https://api.github.com/repos/superdesk/superdesk","forks_url":"https://api.github.com/repos/superdesk/superdesk/forks","keys_url":"https://api.github.com/repos/superdesk/superdesk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/superdesk/superdesk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/superdesk/superdesk/teams","hooks_url":"https://api.github.com/repos/superdesk/superdesk/hooks","issue_events_url":"https://api.github.com/repos/superdesk/superdesk/issues/events{/number}","events_url":"https://api.github.com/repos/superdesk/superdesk/events","assignees_url":"https://api.github.com/repos/superdesk/superdesk/assignees{/user}","branches_url":"https://api.github.com/repos/superdesk/superdesk/branches{/branch}","tags_url":"https://api.github.com/repos/superdesk/superdesk/tags","blobs_url":"https://api.github.com/repos/superdesk/superdesk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/superdesk/superdesk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/superdesk/superdesk/git/refs{/sha}","trees_url":"https://api.github.com/repos/superdesk/superdesk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/superdesk/superdesk/statuses/{sha}","languages_url":"https://api.github.com/repos/superdesk/superdesk/languages","stargazers_url":"https://api.github.com/repos/superdesk/superdesk/stargazers","contributors_url":"https://api.github.com/repos/superdesk/superdesk/contributors","subscribers_url":"https://api.github.com/repos/superdesk/superdesk/subscribers","subscription_url":"https://api.github.com/repos/superdesk/superdesk/subscription","commits_url":"https://api.github.com/repos/superdesk/superdesk/commits{/sha}","git_commits_url":"https://api.github.com/repos/superdesk/superdesk/git/commits{/sha}","comments_url":"https://api.github.com/repos/superdesk/superdesk/comments{/number}","issue_comment_url":"https://api.github.com/repos/superdesk/superdesk/issues/comments{/number}","contents_url":"https://api.github.com/repos/superdesk/superdesk/contents/{+path}","compare_url":"https://api.github.com/repos/superdesk/superdesk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/superdesk/superdesk/merges","archive_url":"https://api.github.com/repos/superdesk/superdesk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/superdesk/superdesk/downloads","issues_url":"https://api.github.com/repos/superdesk/superdesk/issues{/number}","pulls_url":"https://api.github.com/repos/superdesk/superdesk/pulls{/number}","milestones_url":"https://api.github.com/repos/superdesk/superdesk/milestones{/number}","notifications_url":"https://api.github.com/repos/superdesk/superdesk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/superdesk/superdesk/labels{/name}","releases_url":"https://api.github.com/repos/superdesk/superdesk/releases{/id}","created_at":"2014-09-02T07:56:17Z","updated_at":"2015-09-18T18:06:16Z","pushed_at":"2015-09-24T08:13:08Z","git_url":"git://github.com/superdesk/superdesk.git","ssh_url":"git@github.com:superdesk/superdesk.git","clone_url":"https://github.com/superdesk/superdesk.git","svn_url":"https://github.com/superdesk/superdesk","homepage":"","size":69654,"stargazers_count":33,"watchers_count":33,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":8,"forks":35,"open_issues":8,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/superdesk/superdesk/pulls/1130"},"html":{"href":"https://github.com/superdesk/superdesk/pull/1130"},"issue":{"href":"https://api.github.com/repos/superdesk/superdesk/issues/1130"},"comments":{"href":"https://api.github.com/repos/superdesk/superdesk/issues/1130/comments"},"review_comments":{"href":"https://api.github.com/repos/superdesk/superdesk/pulls/1130/comments"},"review_comment":{"href":"https://api.github.com/repos/superdesk/superdesk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/superdesk/superdesk/pulls/1130/commits"},"statuses":{"href":"https://api.github.com/repos/superdesk/superdesk/statuses/79511bf5f91b34514d46148bbc6fa1ce55b5bebf"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"amagdas","id":204229,"avatar_url":"https://avatars.githubusercontent.com/u/204229?v=3","gravatar_id":"","url":"https://api.github.com/users/amagdas","html_url":"https://github.com/amagdas","followers_url":"https://api.github.com/users/amagdas/followers","following_url":"https://api.github.com/users/amagdas/following{/other_user}","gists_url":"https://api.github.com/users/amagdas/gists{/gist_id}","starred_url":"https://api.github.com/users/amagdas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amagdas/subscriptions","organizations_url":"https://api.github.com/users/amagdas/orgs","repos_url":"https://api.github.com/users/amagdas/repos","events_url":"https://api.github.com/users/amagdas/events{/privacy}","received_events_url":"https://api.github.com/users/amagdas/received_events","type":"User","site_admin":false},"comments":21,"review_comments":6,"commits":9,"additions":2679,"deletions":1957,"changed_files":54}}