{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/comments/122047492","pull_request_review_id":44124224,"id":122047492,"diff_hunk":"@@ -0,0 +1,211 @@\n+# This Source Code Form is subject to the terms of the Mozilla Public\n+# License, v. 2.0. If a copy of the MPL was not distributed with this\n+# file, You can obtain one at http://mozilla.org/MPL/2.0/.\n+#\n+# This Source Code Form is \"Incompatible With Secondary Licenses\", as\n+# defined by the Mozilla Public License, v. 2.0.\n+\n+package Bugzilla::Extension::PhabBugz::Util;\n+\n+use 5.10.1;\n+use strict;\n+use warnings;\n+\n+use Bugzilla::Error;\n+\n+use Data::Dumper;\n+use JSON qw(encode_json decode_json);\n+use LWP::UserAgent;\n+\n+use base qw(Exporter);\n+\n+our @EXPORT = qw(\n+    create_private_revision_policy\n+    create_project\n+    edit_revision_policy\n+    get_members_by_bmo_id\n+    get_project_phid\n+    intersect\n+    make_revision_public\n+    request\n+    set_project_members\n+);\n+\n+sub intersect {\n+    my ($list1, $list2) = @_;\n+    my %e = map { $_ => undef } @{$list1};\n+    return grep { exists( $e{$_} ) } @{$list2};\n+}\n+\n+sub create_private_revision_policy {\n+    my ($bug, $groups) = @_;\n+\n+    my $project_phids = [];\n+    foreach my $group (@$groups) {\n+        my $phid = get_project_phid('bmo-' . $group);\n+        push(@$project_phids, $phid) if $phid;\n+    }\n+\n+    @$project_phids\n+        || ThrowUserError('invalid_phabricator_sync_groups');","path":"extensions/PhabBugz/lib/Util.pm","position":50,"original_position":50,"commit_id":"4e3a893e5e690493b8b45b363c8bc88c9e8686f6","original_commit_id":"4e3a893e5e690493b8b45b363c8bc88c9e8686f6","user":{"login":"dylanwh","id":47717,"avatar_url":"https://avatars3.githubusercontent.com/u/47717?v=3","gravatar_id":"","url":"https://api.github.com/users/dylanwh","html_url":"https://github.com/dylanwh","followers_url":"https://api.github.com/users/dylanwh/followers","following_url":"https://api.github.com/users/dylanwh/following{/other_user}","gists_url":"https://api.github.com/users/dylanwh/gists{/gist_id}","starred_url":"https://api.github.com/users/dylanwh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylanwh/subscriptions","organizations_url":"https://api.github.com/users/dylanwh/orgs","repos_url":"https://api.github.com/users/dylanwh/repos","events_url":"https://api.github.com/users/dylanwh/events{/privacy}","received_events_url":"https://api.github.com/users/dylanwh/received_events","type":"User","site_admin":false},"body":"```perl\r\nThrowUserError('invalid_phabricator_sync_groups') unless @$project_phids\r\n```","created_at":"2017-06-14T19:52:10Z","updated_at":"2017-06-14T19:54:45Z","html_url":"https://github.com/mozilla-bteam/bmo/pull/97#discussion_r122047492","pull_request_url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/97","_links":{"self":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/comments/122047492"},"html":{"href":"https://github.com/mozilla-bteam/bmo/pull/97#discussion_r122047492"},"pull_request":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/97"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/97","id":125153394,"html_url":"https://github.com/mozilla-bteam/bmo/pull/97","diff_url":"https://github.com/mozilla-bteam/bmo/pull/97.diff","patch_url":"https://github.com/mozilla-bteam/bmo/pull/97.patch","issue_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues/97","number":97,"state":"open","locked":false,"title":"WIP: Bug 1367604 - BMO extension to apply security policies to Phabricator revisions as needed","user":{"login":"dklawren","id":826315,"avatar_url":"https://avatars1.githubusercontent.com/u/826315?v=3","gravatar_id":"","url":"https://api.github.com/users/dklawren","html_url":"https://github.com/dklawren","followers_url":"https://api.github.com/users/dklawren/followers","following_url":"https://api.github.com/users/dklawren/following{/other_user}","gists_url":"https://api.github.com/users/dklawren/gists{/gist_id}","starred_url":"https://api.github.com/users/dklawren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dklawren/subscriptions","organizations_url":"https://api.github.com/users/dklawren/orgs","repos_url":"https://api.github.com/users/dklawren/repos","events_url":"https://api.github.com/users/dklawren/events{/privacy}","received_events_url":"https://api.github.com/users/dklawren/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-06-12T14:43:44Z","updated_at":"2017-06-14T19:54:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3cf1a2bae0f92167f615661970b4d4d896b146a3","assignee":{"login":"dklawren","id":826315,"avatar_url":"https://avatars1.githubusercontent.com/u/826315?v=3","gravatar_id":"","url":"https://api.github.com/users/dklawren","html_url":"https://github.com/dklawren","followers_url":"https://api.github.com/users/dklawren/followers","following_url":"https://api.github.com/users/dklawren/following{/other_user}","gists_url":"https://api.github.com/users/dklawren/gists{/gist_id}","starred_url":"https://api.github.com/users/dklawren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dklawren/subscriptions","organizations_url":"https://api.github.com/users/dklawren/orgs","repos_url":"https://api.github.com/users/dklawren/repos","events_url":"https://api.github.com/users/dklawren/events{/privacy}","received_events_url":"https://api.github.com/users/dklawren/received_events","type":"User","site_admin":false},"assignees":[{"login":"dklawren","id":826315,"avatar_url":"https://avatars1.githubusercontent.com/u/826315?v=3","gravatar_id":"","url":"https://api.github.com/users/dklawren","html_url":"https://github.com/dklawren","followers_url":"https://api.github.com/users/dklawren/followers","following_url":"https://api.github.com/users/dklawren/following{/other_user}","gists_url":"https://api.github.com/users/dklawren/gists{/gist_id}","starred_url":"https://api.github.com/users/dklawren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dklawren/subscriptions","organizations_url":"https://api.github.com/users/dklawren/orgs","repos_url":"https://api.github.com/users/dklawren/repos","events_url":"https://api.github.com/users/dklawren/events{/privacy}","received_events_url":"https://api.github.com/users/dklawren/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"darkwing","id":46655,"avatar_url":"https://avatars3.githubusercontent.com/u/46655?v=3","gravatar_id":"","url":"https://api.github.com/users/darkwing","html_url":"https://github.com/darkwing","followers_url":"https://api.github.com/users/darkwing/followers","following_url":"https://api.github.com/users/darkwing/following{/other_user}","gists_url":"https://api.github.com/users/darkwing/gists{/gist_id}","starred_url":"https://api.github.com/users/darkwing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darkwing/subscriptions","organizations_url":"https://api.github.com/users/darkwing/orgs","repos_url":"https://api.github.com/users/darkwing/repos","events_url":"https://api.github.com/users/darkwing/events{/privacy}","received_events_url":"https://api.github.com/users/darkwing/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/97/commits","review_comments_url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/97/comments","review_comment_url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues/97/comments","statuses_url":"https://api.github.com/repos/mozilla-bteam/bmo/statuses/4e3a893e5e690493b8b45b363c8bc88c9e8686f6","head":{"label":"mozilla-bteam:dklawren-bug-1367604","ref":"dklawren-bug-1367604","sha":"4e3a893e5e690493b8b45b363c8bc88c9e8686f6","user":{"login":"mozilla-bteam","id":18560992,"avatar_url":"https://avatars0.githubusercontent.com/u/18560992?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-bteam","html_url":"https://github.com/mozilla-bteam","followers_url":"https://api.github.com/users/mozilla-bteam/followers","following_url":"https://api.github.com/users/mozilla-bteam/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-bteam/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-bteam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-bteam/subscriptions","organizations_url":"https://api.github.com/users/mozilla-bteam/orgs","repos_url":"https://api.github.com/users/mozilla-bteam/repos","events_url":"https://api.github.com/users/mozilla-bteam/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-bteam/received_events","type":"Organization","site_admin":false},"repo":{"id":17650869,"name":"bmo","full_name":"mozilla-bteam/bmo","owner":{"login":"mozilla-bteam","id":18560992,"avatar_url":"https://avatars0.githubusercontent.com/u/18560992?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-bteam","html_url":"https://github.com/mozilla-bteam","followers_url":"https://api.github.com/users/mozilla-bteam/followers","following_url":"https://api.github.com/users/mozilla-bteam/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-bteam/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-bteam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-bteam/subscriptions","organizations_url":"https://api.github.com/users/mozilla-bteam/orgs","repos_url":"https://api.github.com/users/mozilla-bteam/repos","events_url":"https://api.github.com/users/mozilla-bteam/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-bteam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-bteam/bmo","description":"bugzilla.mozilla.org source","fork":false,"url":"https://api.github.com/repos/mozilla-bteam/bmo","forks_url":"https://api.github.com/repos/mozilla-bteam/bmo/forks","keys_url":"https://api.github.com/repos/mozilla-bteam/bmo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-bteam/bmo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-bteam/bmo/teams","hooks_url":"https://api.github.com/repos/mozilla-bteam/bmo/hooks","issue_events_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-bteam/bmo/events","assignees_url":"https://api.github.com/repos/mozilla-bteam/bmo/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-bteam/bmo/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-bteam/bmo/tags","blobs_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-bteam/bmo/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-bteam/bmo/languages","stargazers_url":"https://api.github.com/repos/mozilla-bteam/bmo/stargazers","contributors_url":"https://api.github.com/repos/mozilla-bteam/bmo/contributors","subscribers_url":"https://api.github.com/repos/mozilla-bteam/bmo/subscribers","subscription_url":"https://api.github.com/repos/mozilla-bteam/bmo/subscription","commits_url":"https://api.github.com/repos/mozilla-bteam/bmo/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-bteam/bmo/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-bteam/bmo/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-bteam/bmo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-bteam/bmo/merges","archive_url":"https://api.github.com/repos/mozilla-bteam/bmo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-bteam/bmo/downloads","issues_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-bteam/bmo/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-bteam/bmo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-bteam/bmo/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-bteam/bmo/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla-bteam/bmo/deployments","created_at":"2014-03-12T01:03:55Z","updated_at":"2017-06-06T21:56:03Z","pushed_at":"2017-06-14T19:53:29Z","git_url":"git://github.com/mozilla-bteam/bmo.git","ssh_url":"git@github.com:mozilla-bteam/bmo.git","clone_url":"https://github.com/mozilla-bteam/bmo.git","svn_url":"https://github.com/mozilla-bteam/bmo","homepage":"","size":40985,"stargazers_count":31,"watchers_count":31,"language":"Perl","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":21,"forks":48,"open_issues":21,"watchers":31,"default_branch":"master"}},"base":{"label":"mozilla-bteam:master","ref":"master","sha":"9243cbb3b6f014563d15c8b7ababdd55a722627a","user":{"login":"mozilla-bteam","id":18560992,"avatar_url":"https://avatars0.githubusercontent.com/u/18560992?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-bteam","html_url":"https://github.com/mozilla-bteam","followers_url":"https://api.github.com/users/mozilla-bteam/followers","following_url":"https://api.github.com/users/mozilla-bteam/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-bteam/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-bteam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-bteam/subscriptions","organizations_url":"https://api.github.com/users/mozilla-bteam/orgs","repos_url":"https://api.github.com/users/mozilla-bteam/repos","events_url":"https://api.github.com/users/mozilla-bteam/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-bteam/received_events","type":"Organization","site_admin":false},"repo":{"id":17650869,"name":"bmo","full_name":"mozilla-bteam/bmo","owner":{"login":"mozilla-bteam","id":18560992,"avatar_url":"https://avatars0.githubusercontent.com/u/18560992?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-bteam","html_url":"https://github.com/mozilla-bteam","followers_url":"https://api.github.com/users/mozilla-bteam/followers","following_url":"https://api.github.com/users/mozilla-bteam/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-bteam/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-bteam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-bteam/subscriptions","organizations_url":"https://api.github.com/users/mozilla-bteam/orgs","repos_url":"https://api.github.com/users/mozilla-bteam/repos","events_url":"https://api.github.com/users/mozilla-bteam/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-bteam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-bteam/bmo","description":"bugzilla.mozilla.org source","fork":false,"url":"https://api.github.com/repos/mozilla-bteam/bmo","forks_url":"https://api.github.com/repos/mozilla-bteam/bmo/forks","keys_url":"https://api.github.com/repos/mozilla-bteam/bmo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-bteam/bmo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-bteam/bmo/teams","hooks_url":"https://api.github.com/repos/mozilla-bteam/bmo/hooks","issue_events_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-bteam/bmo/events","assignees_url":"https://api.github.com/repos/mozilla-bteam/bmo/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-bteam/bmo/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-bteam/bmo/tags","blobs_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-bteam/bmo/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-bteam/bmo/languages","stargazers_url":"https://api.github.com/repos/mozilla-bteam/bmo/stargazers","contributors_url":"https://api.github.com/repos/mozilla-bteam/bmo/contributors","subscribers_url":"https://api.github.com/repos/mozilla-bteam/bmo/subscribers","subscription_url":"https://api.github.com/repos/mozilla-bteam/bmo/subscription","commits_url":"https://api.github.com/repos/mozilla-bteam/bmo/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-bteam/bmo/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-bteam/bmo/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-bteam/bmo/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-bteam/bmo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-bteam/bmo/merges","archive_url":"https://api.github.com/repos/mozilla-bteam/bmo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-bteam/bmo/downloads","issues_url":"https://api.github.com/repos/mozilla-bteam/bmo/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-bteam/bmo/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-bteam/bmo/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-bteam/bmo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-bteam/bmo/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-bteam/bmo/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla-bteam/bmo/deployments","created_at":"2014-03-12T01:03:55Z","updated_at":"2017-06-06T21:56:03Z","pushed_at":"2017-06-14T19:53:29Z","git_url":"git://github.com/mozilla-bteam/bmo.git","ssh_url":"git@github.com:mozilla-bteam/bmo.git","clone_url":"https://github.com/mozilla-bteam/bmo.git","svn_url":"https://github.com/mozilla-bteam/bmo","homepage":"","size":40985,"stargazers_count":31,"watchers_count":31,"language":"Perl","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":21,"forks":48,"open_issues":21,"watchers":31,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/97"},"html":{"href":"https://github.com/mozilla-bteam/bmo/pull/97"},"issue":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/issues/97"},"comments":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/issues/97/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/97/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/pulls/97/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-bteam/bmo/statuses/4e3a893e5e690493b8b45b363c8bc88c9e8686f6"}}}}
{"actor":{"display_login":"dylanwh"}}