{"action":"created","comment":{"url":"https://api.github.com/repos/getsentry/sentry/pulls/comments/215793522","pull_request_review_id":153140712,"id":215793522,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNTc5MzUyMg==","diff_hunk":"@@ -0,0 +1,42 @@\n+from __future__ import absolute_import\n+\n+\n+from django.views.decorators.csrf import csrf_exempt\n+\n+from sentry.api.base import Endpoint\n+from sentry.constants import ObjectStatus\n+from sentry.models import Repository\n+from sentry.integrations.atlassian_connect import AtlassianConnectValidationError, get_integration_from_jwt\n+\n+\n+class BitbucketUninstalledEndpoint(Endpoint):\n+    authentication_classes = ()\n+    permission_classes = ()\n+\n+    @csrf_exempt\n+    def dispatch(self, request, *args, **kwargs):\n+        return super(BitbucketUninstalledEndpoint, self).dispatch(request, *args, **kwargs)\n+\n+    def post(self, request, *args, **kwargs):\n+        try:\n+            token = request.META['HTTP_AUTHORIZATION'].split(' ', 1)[1]\n+        except (KeyError, IndexError):\n+            return self.respond(status=400)\n+\n+        try:\n+            integration = get_integration_from_jwt(\n+                token, request.path, 'bitbucket', request.GET, method='POST'\n+            )\n+        except AtlassianConnectValidationError:\n+            return self.respond(status=400)\n+\n+        integration.update(status=ObjectStatus.DISABLED)","path":"src/sentry/integrations/bitbucket/uninstalled.py","position":33,"original_position":33,"commit_id":"7ac01ca4370e1e209278463e7da061738a77fe29","original_commit_id":"7ac01ca4370e1e209278463e7da061738a77fe29","user":{"login":"lauryndbrown","id":12959365,"node_id":"MDQ6VXNlcjEyOTU5MzY1","avatar_url":"https://avatars0.githubusercontent.com/u/12959365?v=4","gravatar_id":"","url":"https://api.github.com/users/lauryndbrown","html_url":"https://github.com/lauryndbrown","followers_url":"https://api.github.com/users/lauryndbrown/followers","following_url":"https://api.github.com/users/lauryndbrown/following{/other_user}","gists_url":"https://api.github.com/users/lauryndbrown/gists{/gist_id}","starred_url":"https://api.github.com/users/lauryndbrown/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauryndbrown/subscriptions","organizations_url":"https://api.github.com/users/lauryndbrown/orgs","repos_url":"https://api.github.com/users/lauryndbrown/repos","events_url":"https://api.github.com/users/lauryndbrown/events{/privacy}","received_events_url":"https://api.github.com/users/lauryndbrown/received_events","type":"User","site_admin":false},"body":"If the `Integration` is disabled, I'd argue that all `OrganizationIntegration`s should also be disabled. ","created_at":"2018-09-06T22:06:52Z","updated_at":"2018-09-06T22:09:08Z","html_url":"https://github.com/getsentry/sentry/pull/9632#discussion_r215793522","pull_request_url":"https://api.github.com/repos/getsentry/sentry/pulls/9632","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/getsentry/sentry/pulls/comments/215793522"},"html":{"href":"https://github.com/getsentry/sentry/pull/9632#discussion_r215793522"},"pull_request":{"href":"https://api.github.com/repos/getsentry/sentry/pulls/9632"}},"in_reply_to_id":215793446},"pull_request":{"url":"https://api.github.com/repos/getsentry/sentry/pulls/9632","id":213424976,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzNDI0OTc2","html_url":"https://github.com/getsentry/sentry/pull/9632","diff_url":"https://github.com/getsentry/sentry/pull/9632.diff","patch_url":"https://github.com/getsentry/sentry/pull/9632.patch","issue_url":"https://api.github.com/repos/getsentry/sentry/issues/9632","number":9632,"state":"open","locked":false,"title":"ref(integrations): Handle uninstall from Bitbucket","user":{"login":"MeredithAnya","id":15368179,"node_id":"MDQ6VXNlcjE1MzY4MTc5","avatar_url":"https://avatars0.githubusercontent.com/u/15368179?v=4","gravatar_id":"","url":"https://api.github.com/users/MeredithAnya","html_url":"https://github.com/MeredithAnya","followers_url":"https://api.github.com/users/MeredithAnya/followers","following_url":"https://api.github.com/users/MeredithAnya/following{/other_user}","gists_url":"https://api.github.com/users/MeredithAnya/gists{/gist_id}","starred_url":"https://api.github.com/users/MeredithAnya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MeredithAnya/subscriptions","organizations_url":"https://api.github.com/users/MeredithAnya/orgs","repos_url":"https://api.github.com/users/MeredithAnya/repos","events_url":"https://api.github.com/users/MeredithAnya/events{/privacy}","received_events_url":"https://api.github.com/users/MeredithAnya/received_events","type":"User","site_admin":false},"body":"When uninstalling from BB their integration and associated repos will be disabled\r\n\r\n![screen shot 2018-09-05 at 1 44 53 pm](https://user-images.githubusercontent.com/15368179/45120056-eaffe780-b111-11e8-9543-10447be7533d.png)\r\n\r\n\r\nCurrent reinstall flow:\r\n* ' Enable' actually creates a new installation for the same BitBucket account (since the `external_id` will change)\r\n* Previously disabled repos will still be disabled and also tied to the disabled integration\r\n\r\n**We don't really want people to uninstall from bitbucket though**","created_at":"2018-09-05T20:55:29Z","updated_at":"2018-09-06T22:09:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6fa4941e04758868d6bd2b225f143cbad56cd8e6","assignee":null,"assignees":[],"requested_reviewers":[{"login":"EvanPurkhiser","id":1421724,"node_id":"MDQ6VXNlcjE0MjE3MjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1421724?v=4","gravatar_id":"","url":"https://api.github.com/users/EvanPurkhiser","html_url":"https://github.com/EvanPurkhiser","followers_url":"https://api.github.com/users/EvanPurkhiser/followers","following_url":"https://api.github.com/users/EvanPurkhiser/following{/other_user}","gists_url":"https://api.github.com/users/EvanPurkhiser/gists{/gist_id}","starred_url":"https://api.github.com/users/EvanPurkhiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EvanPurkhiser/subscriptions","organizations_url":"https://api.github.com/users/EvanPurkhiser/orgs","repos_url":"https://api.github.com/users/EvanPurkhiser/repos","events_url":"https://api.github.com/users/EvanPurkhiser/events{/privacy}","received_events_url":"https://api.github.com/users/EvanPurkhiser/received_events","type":"User","site_admin":false},{"login":"macqueen","id":5026776,"node_id":"MDQ6VXNlcjUwMjY3NzY=","avatar_url":"https://avatars2.githubusercontent.com/u/5026776?v=4","gravatar_id":"","url":"https://api.github.com/users/macqueen","html_url":"https://github.com/macqueen","followers_url":"https://api.github.com/users/macqueen/followers","following_url":"https://api.github.com/users/macqueen/following{/other_user}","gists_url":"https://api.github.com/users/macqueen/gists{/gist_id}","starred_url":"https://api.github.com/users/macqueen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macqueen/subscriptions","organizations_url":"https://api.github.com/users/macqueen/orgs","repos_url":"https://api.github.com/users/macqueen/repos","events_url":"https://api.github.com/users/macqueen/events{/privacy}","received_events_url":"https://api.github.com/users/macqueen/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/getsentry/sentry/pulls/9632/commits","review_comments_url":"https://api.github.com/repos/getsentry/sentry/pulls/9632/comments","review_comment_url":"https://api.github.com/repos/getsentry/sentry/pulls/comments{/number}","comments_url":"https://api.github.com/repos/getsentry/sentry/issues/9632/comments","statuses_url":"https://api.github.com/repos/getsentry/sentry/statuses/7ac01ca4370e1e209278463e7da061738a77fe29","head":{"label":"getsentry:bb-uninstall","ref":"bb-uninstall","sha":"7ac01ca4370e1e209278463e7da061738a77fe29","user":{"login":"getsentry","id":1396951,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzOTY5NTE=","avatar_url":"https://avatars0.githubusercontent.com/u/1396951?v=4","gravatar_id":"","url":"https://api.github.com/users/getsentry","html_url":"https://github.com/getsentry","followers_url":"https://api.github.com/users/getsentry/followers","following_url":"https://api.github.com/users/getsentry/following{/other_user}","gists_url":"https://api.github.com/users/getsentry/gists{/gist_id}","starred_url":"https://api.github.com/users/getsentry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getsentry/subscriptions","organizations_url":"https://api.github.com/users/getsentry/orgs","repos_url":"https://api.github.com/users/getsentry/repos","events_url":"https://api.github.com/users/getsentry/events{/privacy}","received_events_url":"https://api.github.com/users/getsentry/received_events","type":"Organization","site_admin":false},"repo":{"id":873328,"node_id":"MDEwOlJlcG9zaXRvcnk4NzMzMjg=","name":"sentry","full_name":"getsentry/sentry","owner":{"login":"getsentry","id":1396951,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzOTY5NTE=","avatar_url":"https://avatars0.githubusercontent.com/u/1396951?v=4","gravatar_id":"","url":"https://api.github.com/users/getsentry","html_url":"https://github.com/getsentry","followers_url":"https://api.github.com/users/getsentry/followers","following_url":"https://api.github.com/users/getsentry/following{/other_user}","gists_url":"https://api.github.com/users/getsentry/gists{/gist_id}","starred_url":"https://api.github.com/users/getsentry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getsentry/subscriptions","organizations_url":"https://api.github.com/users/getsentry/orgs","repos_url":"https://api.github.com/users/getsentry/repos","events_url":"https://api.github.com/users/getsentry/events{/privacy}","received_events_url":"https://api.github.com/users/getsentry/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getsentry/sentry","description":"Sentry is cross-platform application monitoring, with a focus on error reporting.","fork":false,"url":"https://api.github.com/repos/getsentry/sentry","forks_url":"https://api.github.com/repos/getsentry/sentry/forks","keys_url":"https://api.github.com/repos/getsentry/sentry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getsentry/sentry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getsentry/sentry/teams","hooks_url":"https://api.github.com/repos/getsentry/sentry/hooks","issue_events_url":"https://api.github.com/repos/getsentry/sentry/issues/events{/number}","events_url":"https://api.github.com/repos/getsentry/sentry/events","assignees_url":"https://api.github.com/repos/getsentry/sentry/assignees{/user}","branches_url":"https://api.github.com/repos/getsentry/sentry/branches{/branch}","tags_url":"https://api.github.com/repos/getsentry/sentry/tags","blobs_url":"https://api.github.com/repos/getsentry/sentry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getsentry/sentry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getsentry/sentry/git/refs{/sha}","trees_url":"https://api.github.com/repos/getsentry/sentry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getsentry/sentry/statuses/{sha}","languages_url":"https://api.github.com/repos/getsentry/sentry/languages","stargazers_url":"https://api.github.com/repos/getsentry/sentry/stargazers","contributors_url":"https://api.github.com/repos/getsentry/sentry/contributors","subscribers_url":"https://api.github.com/repos/getsentry/sentry/subscribers","subscription_url":"https://api.github.com/repos/getsentry/sentry/subscription","commits_url":"https://api.github.com/repos/getsentry/sentry/commits{/sha}","git_commits_url":"https://api.github.com/repos/getsentry/sentry/git/commits{/sha}","comments_url":"https://api.github.com/repos/getsentry/sentry/comments{/number}","issue_comment_url":"https://api.github.com/repos/getsentry/sentry/issues/comments{/number}","contents_url":"https://api.github.com/repos/getsentry/sentry/contents/{+path}","compare_url":"https://api.github.com/repos/getsentry/sentry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getsentry/sentry/merges","archive_url":"https://api.github.com/repos/getsentry/sentry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getsentry/sentry/downloads","issues_url":"https://api.github.com/repos/getsentry/sentry/issues{/number}","pulls_url":"https://api.github.com/repos/getsentry/sentry/pulls{/number}","milestones_url":"https://api.github.com/repos/getsentry/sentry/milestones{/number}","notifications_url":"https://api.github.com/repos/getsentry/sentry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getsentry/sentry/labels{/name}","releases_url":"https://api.github.com/repos/getsentry/sentry/releases{/id}","deployments_url":"https://api.github.com/repos/getsentry/sentry/deployments","created_at":"2010-08-30T22:06:41Z","updated_at":"2018-09-06T21:53:01Z","pushed_at":"2018-09-06T22:06:25Z","git_url":"git://github.com/getsentry/sentry.git","ssh_url":"git@github.com:getsentry/sentry.git","clone_url":"https://github.com/getsentry/sentry.git","svn_url":"https://github.com/getsentry/sentry","homepage":"https://sentry.io","size":92195,"stargazers_count":17961,"watchers_count":17961,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2077,"mirror_url":null,"archived":false,"open_issues_count":840,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":2077,"open_issues":840,"watchers":17961,"default_branch":"master"}},"base":{"label":"getsentry:master","ref":"master","sha":"921c375c39fa07c25e3c4c810b88942b7a17d503","user":{"login":"getsentry","id":1396951,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzOTY5NTE=","avatar_url":"https://avatars0.githubusercontent.com/u/1396951?v=4","gravatar_id":"","url":"https://api.github.com/users/getsentry","html_url":"https://github.com/getsentry","followers_url":"https://api.github.com/users/getsentry/followers","following_url":"https://api.github.com/users/getsentry/following{/other_user}","gists_url":"https://api.github.com/users/getsentry/gists{/gist_id}","starred_url":"https://api.github.com/users/getsentry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getsentry/subscriptions","organizations_url":"https://api.github.com/users/getsentry/orgs","repos_url":"https://api.github.com/users/getsentry/repos","events_url":"https://api.github.com/users/getsentry/events{/privacy}","received_events_url":"https://api.github.com/users/getsentry/received_events","type":"Organization","site_admin":false},"repo":{"id":873328,"node_id":"MDEwOlJlcG9zaXRvcnk4NzMzMjg=","name":"sentry","full_name":"getsentry/sentry","owner":{"login":"getsentry","id":1396951,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzOTY5NTE=","avatar_url":"https://avatars0.githubusercontent.com/u/1396951?v=4","gravatar_id":"","url":"https://api.github.com/users/getsentry","html_url":"https://github.com/getsentry","followers_url":"https://api.github.com/users/getsentry/followers","following_url":"https://api.github.com/users/getsentry/following{/other_user}","gists_url":"https://api.github.com/users/getsentry/gists{/gist_id}","starred_url":"https://api.github.com/users/getsentry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getsentry/subscriptions","organizations_url":"https://api.github.com/users/getsentry/orgs","repos_url":"https://api.github.com/users/getsentry/repos","events_url":"https://api.github.com/users/getsentry/events{/privacy}","received_events_url":"https://api.github.com/users/getsentry/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getsentry/sentry","description":"Sentry is cross-platform application monitoring, with a focus on error reporting.","fork":false,"url":"https://api.github.com/repos/getsentry/sentry","forks_url":"https://api.github.com/repos/getsentry/sentry/forks","keys_url":"https://api.github.com/repos/getsentry/sentry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getsentry/sentry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getsentry/sentry/teams","hooks_url":"https://api.github.com/repos/getsentry/sentry/hooks","issue_events_url":"https://api.github.com/repos/getsentry/sentry/issues/events{/number}","events_url":"https://api.github.com/repos/getsentry/sentry/events","assignees_url":"https://api.github.com/repos/getsentry/sentry/assignees{/user}","branches_url":"https://api.github.com/repos/getsentry/sentry/branches{/branch}","tags_url":"https://api.github.com/repos/getsentry/sentry/tags","blobs_url":"https://api.github.com/repos/getsentry/sentry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getsentry/sentry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getsentry/sentry/git/refs{/sha}","trees_url":"https://api.github.com/repos/getsentry/sentry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getsentry/sentry/statuses/{sha}","languages_url":"https://api.github.com/repos/getsentry/sentry/languages","stargazers_url":"https://api.github.com/repos/getsentry/sentry/stargazers","contributors_url":"https://api.github.com/repos/getsentry/sentry/contributors","subscribers_url":"https://api.github.com/repos/getsentry/sentry/subscribers","subscription_url":"https://api.github.com/repos/getsentry/sentry/subscription","commits_url":"https://api.github.com/repos/getsentry/sentry/commits{/sha}","git_commits_url":"https://api.github.com/repos/getsentry/sentry/git/commits{/sha}","comments_url":"https://api.github.com/repos/getsentry/sentry/comments{/number}","issue_comment_url":"https://api.github.com/repos/getsentry/sentry/issues/comments{/number}","contents_url":"https://api.github.com/repos/getsentry/sentry/contents/{+path}","compare_url":"https://api.github.com/repos/getsentry/sentry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getsentry/sentry/merges","archive_url":"https://api.github.com/repos/getsentry/sentry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getsentry/sentry/downloads","issues_url":"https://api.github.com/repos/getsentry/sentry/issues{/number}","pulls_url":"https://api.github.com/repos/getsentry/sentry/pulls{/number}","milestones_url":"https://api.github.com/repos/getsentry/sentry/milestones{/number}","notifications_url":"https://api.github.com/repos/getsentry/sentry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getsentry/sentry/labels{/name}","releases_url":"https://api.github.com/repos/getsentry/sentry/releases{/id}","deployments_url":"https://api.github.com/repos/getsentry/sentry/deployments","created_at":"2010-08-30T22:06:41Z","updated_at":"2018-09-06T21:53:01Z","pushed_at":"2018-09-06T22:06:25Z","git_url":"git://github.com/getsentry/sentry.git","ssh_url":"git@github.com:getsentry/sentry.git","clone_url":"https://github.com/getsentry/sentry.git","svn_url":"https://github.com/getsentry/sentry","homepage":"https://sentry.io","size":92195,"stargazers_count":17961,"watchers_count":17961,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2077,"mirror_url":null,"archived":false,"open_issues_count":840,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":2077,"open_issues":840,"watchers":17961,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/getsentry/sentry/pulls/9632"},"html":{"href":"https://github.com/getsentry/sentry/pull/9632"},"issue":{"href":"https://api.github.com/repos/getsentry/sentry/issues/9632"},"comments":{"href":"https://api.github.com/repos/getsentry/sentry/issues/9632/comments"},"review_comments":{"href":"https://api.github.com/repos/getsentry/sentry/pulls/9632/comments"},"review_comment":{"href":"https://api.github.com/repos/getsentry/sentry/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/getsentry/sentry/pulls/9632/commits"},"statuses":{"href":"https://api.github.com/repos/getsentry/sentry/statuses/7ac01ca4370e1e209278463e7da061738a77fe29"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"lauryndbrown"}}