{"action":"created","comment":{"url":"https://api.github.com/repos/zulip/zulip/pulls/comments/88126005","pull_request_review_id":8707513,"id":88126005,"diff_hunk":"@@ -768,6 +794,66 @@ function _setup_page() {\n         });\n     });\n \n+    $('.admin_filters_table').on('click', '.delete', function (e) {\n+        e.preventDefault();\n+        e.stopPropagation();\n+        var btn = $(this);\n+\n+        channel.del({\n+            url: '/json/realm/filters/' + encodeURIComponent(btn.attr('data-filter-id')),\n+            error: function (xhr, error_type) {\n+                if (xhr.status.toString().charAt(0) === \"4\") {\n+                    btn.closest(\"td\").html(\n+                        $(\"<p>\").addClass(\"text-error\").text($.parseJSON(xhr.responseText).msg)\n+                    );\n+                } else {\n+                     btn.text(\"Failed!\");\n+                }\n+            },\n+            success: function () {\n+                var row = btn.parents('tr');\n+                row.remove();\n+            }\n+        });\n+    });\n+\n+    $(\".administration\").on(\"submit\", \"form.admin-filter-form\", function (e) {\n+        e.preventDefault();\n+        e.stopPropagation();\n+        var filter_status = $('#admin-filter-status');\n+        var pattern_status = $('#admin-filter-pattern-status');\n+        var format_status = $('#admin-filter-format-status');\n+        filter_status.hide();\n+        pattern_status.hide();\n+        format_status.hide();\n+        var filter = {};\n+        $(this).serializeArray().map(function (x){filter[x.name] = x.value;});\n+\n+        channel.put({\n+            url: \"/json/realm/filters\",\n+            data: $(this).serialize(),","path":"static/js/admin.js","position":95,"original_position":95,"commit_id":"600df1aa2f4be3bdf18cd515782f786011765938","original_commit_id":"600df1aa2f4be3bdf18cd515782f786011765938","user":{"login":"timabbott","id":2746074,"avatar_url":"https://avatars.githubusercontent.com/u/2746074?v=3","gravatar_id":"","url":"https://api.github.com/users/timabbott","html_url":"https://github.com/timabbott","followers_url":"https://api.github.com/users/timabbott/followers","following_url":"https://api.github.com/users/timabbott/following{/other_user}","gists_url":"https://api.github.com/users/timabbott/gists{/gist_id}","starred_url":"https://api.github.com/users/timabbott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timabbott/subscriptions","organizations_url":"https://api.github.com/users/timabbott/orgs","repos_url":"https://api.github.com/users/timabbott/repos","events_url":"https://api.github.com/users/timabbott/events{/privacy}","received_events_url":"https://api.github.com/users/timabbott/received_events","type":"User","site_admin":false},"body":"This code seems to have a bug where it doesn't strip whitespace properly; I accidentally had some trailing whitespace in some entries I created via the web UI and got the following filters (they don't work because of the `\\t` characters):\r\n\r\n```\r\n$ ./manage.py realm_filters --r zulip.com \r\nzulip.com: [('#(?P<id>[0-9]+)\\t', 'https://trac.example.com/ticket/%(id)s', 2), ('T(?P<id>[0-9]+)\\t', 'https://trac.example.com/ticket/%(id)s', 3)]\r\n```\r\n\r\n","created_at":"2016-11-15T22:13:07Z","updated_at":"2016-11-15T22:13:07Z","html_url":"https://github.com/zulip/zulip/pull/2261#discussion_r88126005","pull_request_url":"https://api.github.com/repos/zulip/zulip/pulls/2261","_links":{"self":{"href":"https://api.github.com/repos/zulip/zulip/pulls/comments/88126005"},"html":{"href":"https://github.com/zulip/zulip/pull/2261#discussion_r88126005"},"pull_request":{"href":"https://api.github.com/repos/zulip/zulip/pulls/2261"}}},"pull_request":{"url":"https://api.github.com/repos/zulip/zulip/pulls/2261","id":92910110,"html_url":"https://github.com/zulip/zulip/pull/2261","diff_url":"https://github.com/zulip/zulip/pull/2261.diff","patch_url":"https://github.com/zulip/zulip/pull/2261.patch","issue_url":"https://api.github.com/repos/zulip/zulip/issues/2261","number":2261,"state":"open","locked":false,"title":"Custom realm filters","user":{"login":"TigorC","id":1096253,"avatar_url":"https://avatars.githubusercontent.com/u/1096253?v=3","gravatar_id":"","url":"https://api.github.com/users/TigorC","html_url":"https://github.com/TigorC","followers_url":"https://api.github.com/users/TigorC/followers","following_url":"https://api.github.com/users/TigorC/following{/other_user}","gists_url":"https://api.github.com/users/TigorC/gists{/gist_id}","starred_url":"https://api.github.com/users/TigorC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TigorC/subscriptions","organizations_url":"https://api.github.com/users/TigorC/orgs","repos_url":"https://api.github.com/users/TigorC/repos","events_url":"https://api.github.com/users/TigorC/events{/privacy}","received_events_url":"https://api.github.com/users/TigorC/received_events","type":"User","site_admin":false},"body":"This is cleanup and rebase of #544 ","created_at":"2016-11-09T06:11:55Z","updated_at":"2016-11-15T22:25:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e064fd4672e5c50487bd43f2b0118ddb9714175","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zulip/zulip/pulls/2261/commits","review_comments_url":"https://api.github.com/repos/zulip/zulip/pulls/2261/comments","review_comment_url":"https://api.github.com/repos/zulip/zulip/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zulip/zulip/issues/2261/comments","statuses_url":"https://api.github.com/repos/zulip/zulip/statuses/600df1aa2f4be3bdf18cd515782f786011765938","head":{"label":"TigorC:custom-realm-filters","ref":"custom-realm-filters","sha":"600df1aa2f4be3bdf18cd515782f786011765938","user":{"login":"TigorC","id":1096253,"avatar_url":"https://avatars.githubusercontent.com/u/1096253?v=3","gravatar_id":"","url":"https://api.github.com/users/TigorC","html_url":"https://github.com/TigorC","followers_url":"https://api.github.com/users/TigorC/followers","following_url":"https://api.github.com/users/TigorC/following{/other_user}","gists_url":"https://api.github.com/users/TigorC/gists{/gist_id}","starred_url":"https://api.github.com/users/TigorC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TigorC/subscriptions","organizations_url":"https://api.github.com/users/TigorC/orgs","repos_url":"https://api.github.com/users/TigorC/repos","events_url":"https://api.github.com/users/TigorC/events{/privacy}","received_events_url":"https://api.github.com/users/TigorC/received_events","type":"User","site_admin":false},"repo":{"id":71198576,"name":"zulip","full_name":"TigorC/zulip","owner":{"login":"TigorC","id":1096253,"avatar_url":"https://avatars.githubusercontent.com/u/1096253?v=3","gravatar_id":"","url":"https://api.github.com/users/TigorC","html_url":"https://github.com/TigorC","followers_url":"https://api.github.com/users/TigorC/followers","following_url":"https://api.github.com/users/TigorC/following{/other_user}","gists_url":"https://api.github.com/users/TigorC/gists{/gist_id}","starred_url":"https://api.github.com/users/TigorC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TigorC/subscriptions","organizations_url":"https://api.github.com/users/TigorC/orgs","repos_url":"https://api.github.com/users/TigorC/repos","events_url":"https://api.github.com/users/TigorC/events{/privacy}","received_events_url":"https://api.github.com/users/TigorC/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TigorC/zulip","description":"Zulip server - powerful open source group chat","fork":true,"url":"https://api.github.com/repos/TigorC/zulip","forks_url":"https://api.github.com/repos/TigorC/zulip/forks","keys_url":"https://api.github.com/repos/TigorC/zulip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TigorC/zulip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TigorC/zulip/teams","hooks_url":"https://api.github.com/repos/TigorC/zulip/hooks","issue_events_url":"https://api.github.com/repos/TigorC/zulip/issues/events{/number}","events_url":"https://api.github.com/repos/TigorC/zulip/events","assignees_url":"https://api.github.com/repos/TigorC/zulip/assignees{/user}","branches_url":"https://api.github.com/repos/TigorC/zulip/branches{/branch}","tags_url":"https://api.github.com/repos/TigorC/zulip/tags","blobs_url":"https://api.github.com/repos/TigorC/zulip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TigorC/zulip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TigorC/zulip/git/refs{/sha}","trees_url":"https://api.github.com/repos/TigorC/zulip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TigorC/zulip/statuses/{sha}","languages_url":"https://api.github.com/repos/TigorC/zulip/languages","stargazers_url":"https://api.github.com/repos/TigorC/zulip/stargazers","contributors_url":"https://api.github.com/repos/TigorC/zulip/contributors","subscribers_url":"https://api.github.com/repos/TigorC/zulip/subscribers","subscription_url":"https://api.github.com/repos/TigorC/zulip/subscription","commits_url":"https://api.github.com/repos/TigorC/zulip/commits{/sha}","git_commits_url":"https://api.github.com/repos/TigorC/zulip/git/commits{/sha}","comments_url":"https://api.github.com/repos/TigorC/zulip/comments{/number}","issue_comment_url":"https://api.github.com/repos/TigorC/zulip/issues/comments{/number}","contents_url":"https://api.github.com/repos/TigorC/zulip/contents/{+path}","compare_url":"https://api.github.com/repos/TigorC/zulip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TigorC/zulip/merges","archive_url":"https://api.github.com/repos/TigorC/zulip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TigorC/zulip/downloads","issues_url":"https://api.github.com/repos/TigorC/zulip/issues{/number}","pulls_url":"https://api.github.com/repos/TigorC/zulip/pulls{/number}","milestones_url":"https://api.github.com/repos/TigorC/zulip/milestones{/number}","notifications_url":"https://api.github.com/repos/TigorC/zulip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TigorC/zulip/labels{/name}","releases_url":"https://api.github.com/repos/TigorC/zulip/releases{/id}","deployments_url":"https://api.github.com/repos/TigorC/zulip/deployments","created_at":"2016-10-18T01:58:06Z","updated_at":"2016-10-18T01:58:15Z","pushed_at":"2016-11-10T07:21:18Z","git_url":"git://github.com/TigorC/zulip.git","ssh_url":"git@github.com:TigorC/zulip.git","clone_url":"https://github.com/TigorC/zulip.git","svn_url":"https://github.com/TigorC/zulip","homepage":"","size":118511,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"zulip:master","ref":"master","sha":"1def0b6701a8fece572a5f4b93bab9b6b9c72342","user":{"login":"zulip","id":4921959,"avatar_url":"https://avatars.githubusercontent.com/u/4921959?v=3","gravatar_id":"","url":"https://api.github.com/users/zulip","html_url":"https://github.com/zulip","followers_url":"https://api.github.com/users/zulip/followers","following_url":"https://api.github.com/users/zulip/following{/other_user}","gists_url":"https://api.github.com/users/zulip/gists{/gist_id}","starred_url":"https://api.github.com/users/zulip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zulip/subscriptions","organizations_url":"https://api.github.com/users/zulip/orgs","repos_url":"https://api.github.com/users/zulip/repos","events_url":"https://api.github.com/users/zulip/events{/privacy}","received_events_url":"https://api.github.com/users/zulip/received_events","type":"Organization","site_admin":false},"repo":{"id":43160685,"name":"zulip","full_name":"zulip/zulip","owner":{"login":"zulip","id":4921959,"avatar_url":"https://avatars.githubusercontent.com/u/4921959?v=3","gravatar_id":"","url":"https://api.github.com/users/zulip","html_url":"https://github.com/zulip","followers_url":"https://api.github.com/users/zulip/followers","following_url":"https://api.github.com/users/zulip/following{/other_user}","gists_url":"https://api.github.com/users/zulip/gists{/gist_id}","starred_url":"https://api.github.com/users/zulip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zulip/subscriptions","organizations_url":"https://api.github.com/users/zulip/orgs","repos_url":"https://api.github.com/users/zulip/repos","events_url":"https://api.github.com/users/zulip/events{/privacy}","received_events_url":"https://api.github.com/users/zulip/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zulip/zulip","description":"Zulip server - powerful open source group chat","fork":false,"url":"https://api.github.com/repos/zulip/zulip","forks_url":"https://api.github.com/repos/zulip/zulip/forks","keys_url":"https://api.github.com/repos/zulip/zulip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zulip/zulip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zulip/zulip/teams","hooks_url":"https://api.github.com/repos/zulip/zulip/hooks","issue_events_url":"https://api.github.com/repos/zulip/zulip/issues/events{/number}","events_url":"https://api.github.com/repos/zulip/zulip/events","assignees_url":"https://api.github.com/repos/zulip/zulip/assignees{/user}","branches_url":"https://api.github.com/repos/zulip/zulip/branches{/branch}","tags_url":"https://api.github.com/repos/zulip/zulip/tags","blobs_url":"https://api.github.com/repos/zulip/zulip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zulip/zulip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zulip/zulip/git/refs{/sha}","trees_url":"https://api.github.com/repos/zulip/zulip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zulip/zulip/statuses/{sha}","languages_url":"https://api.github.com/repos/zulip/zulip/languages","stargazers_url":"https://api.github.com/repos/zulip/zulip/stargazers","contributors_url":"https://api.github.com/repos/zulip/zulip/contributors","subscribers_url":"https://api.github.com/repos/zulip/zulip/subscribers","subscription_url":"https://api.github.com/repos/zulip/zulip/subscription","commits_url":"https://api.github.com/repos/zulip/zulip/commits{/sha}","git_commits_url":"https://api.github.com/repos/zulip/zulip/git/commits{/sha}","comments_url":"https://api.github.com/repos/zulip/zulip/comments{/number}","issue_comment_url":"https://api.github.com/repos/zulip/zulip/issues/comments{/number}","contents_url":"https://api.github.com/repos/zulip/zulip/contents/{+path}","compare_url":"https://api.github.com/repos/zulip/zulip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zulip/zulip/merges","archive_url":"https://api.github.com/repos/zulip/zulip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zulip/zulip/downloads","issues_url":"https://api.github.com/repos/zulip/zulip/issues{/number}","pulls_url":"https://api.github.com/repos/zulip/zulip/pulls{/number}","milestones_url":"https://api.github.com/repos/zulip/zulip/milestones{/number}","notifications_url":"https://api.github.com/repos/zulip/zulip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zulip/zulip/labels{/name}","releases_url":"https://api.github.com/repos/zulip/zulip/releases{/id}","deployments_url":"https://api.github.com/repos/zulip/zulip/deployments","created_at":"2015-09-25T16:37:25Z","updated_at":"2016-11-15T18:21:32Z","pushed_at":"2016-11-15T21:44:53Z","git_url":"git://github.com/zulip/zulip.git","ssh_url":"git@github.com:zulip/zulip.git","clone_url":"https://github.com/zulip/zulip.git","svn_url":"https://github.com/zulip/zulip","homepage":"","size":129350,"stargazers_count":4270,"watchers_count":4270,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":776,"mirror_url":null,"open_issues_count":540,"forks":776,"open_issues":540,"watchers":4270,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zulip/zulip/pulls/2261"},"html":{"href":"https://github.com/zulip/zulip/pull/2261"},"issue":{"href":"https://api.github.com/repos/zulip/zulip/issues/2261"},"comments":{"href":"https://api.github.com/repos/zulip/zulip/issues/2261/comments"},"review_comments":{"href":"https://api.github.com/repos/zulip/zulip/pulls/2261/comments"},"review_comment":{"href":"https://api.github.com/repos/zulip/zulip/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zulip/zulip/pulls/2261/commits"},"statuses":{"href":"https://api.github.com/repos/zulip/zulip/statuses/600df1aa2f4be3bdf18cd515782f786011765938"}}}}
{"actor":{"display_login":"timabbott"}}