{"action":"created","comment":{"url":"https://api.github.com/repos/praekelt/seed-message-sender/pulls/comments/89733240","pull_request_review_id":10269479,"id":89733240,"diff_hunk":"@@ -95,6 +95,35 @@ def get_serializer_class(self):\n                 return JunebugInboundSerializer\n         return InboundSerializer\n \n+    def create(self, request, *args, **kwargs):\n+        close_event = False\n+        if \"channel_data\" in request.data:  # Handle message from Junebug\n+            if \"session_event\" in request.data[\"channel_data\"]:\n+                if request.data[\"channel_data\"][\"session_event\"] == \"close\":\n+                    close_event = True\n+                    reply_field = \"reply_to\"\n+                    from_field = \"from\"\n+        elif \"session_event\" in request.data:  # Handle message from Vumi\n+            if request.data[\"session_event\"] == \"close\":\n+                close_event = True\n+                reply_field = \"in_reply_to\"\n+                from_field = \"from_addr\"\n+\n+        if close_event:\n+            try:\n+                message = Outbound.objects.get(\n+                    vumi_message_id=request.data[reply_field])\n+            except ObjectDoesNotExist:\n+                message = Outbound.objects.filter(\n+                    to_addr=request.data[from_field]).last()","path":"message_sender/views.py","position":33,"original_position":33,"commit_id":"b9ce6678316e6e9df1eb48e2001dcc8e34aa739b","original_commit_id":"b9ce6678316e6e9df1eb48e2001dcc8e34aa739b","user":{"login":"rudigiesler","id":8234653,"avatar_url":"https://avatars.githubusercontent.com/u/8234653?v=3","gravatar_id":"","url":"https://api.github.com/users/rudigiesler","html_url":"https://github.com/rudigiesler","followers_url":"https://api.github.com/users/rudigiesler/followers","following_url":"https://api.github.com/users/rudigiesler/following{/other_user}","gists_url":"https://api.github.com/users/rudigiesler/gists{/gist_id}","starred_url":"https://api.github.com/users/rudigiesler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rudigiesler/subscriptions","organizations_url":"https://api.github.com/users/rudigiesler/orgs","repos_url":"https://api.github.com/users/rudigiesler/repos","events_url":"https://api.github.com/users/rudigiesler/events{/privacy}","received_events_url":"https://api.github.com/users/rudigiesler/received_events","type":"User","site_admin":false},"body":"I think we need to sort here? I don't think that `last` guarantees us the the last element based on a timestamp.","created_at":"2016-11-28T08:20:30Z","updated_at":"2016-11-28T08:21:19Z","html_url":"https://github.com/praekelt/seed-message-sender/pull/17#discussion_r89733240","pull_request_url":"https://api.github.com/repos/praekelt/seed-message-sender/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/praekelt/seed-message-sender/pulls/comments/89733240"},"html":{"href":"https://github.com/praekelt/seed-message-sender/pull/17#discussion_r89733240"},"pull_request":{"href":"https://api.github.com/repos/praekelt/seed-message-sender/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/praekelt/seed-message-sender/pulls/17","id":92303497,"html_url":"https://github.com/praekelt/seed-message-sender/pull/17","diff_url":"https://github.com/praekelt/seed-message-sender/pull/17.diff","patch_url":"https://github.com/praekelt/seed-message-sender/pull/17.patch","issue_url":"https://api.github.com/repos/praekelt/seed-message-sender/issues/17","number":17,"state":"open","locked":false,"title":"Concurrent message limiter","user":{"login":"KaitCrawford","id":1230707,"avatar_url":"https://avatars.githubusercontent.com/u/1230707?v=3","gravatar_id":"","url":"https://api.github.com/users/KaitCrawford","html_url":"https://github.com/KaitCrawford","followers_url":"https://api.github.com/users/KaitCrawford/followers","following_url":"https://api.github.com/users/KaitCrawford/following{/other_user}","gists_url":"https://api.github.com/users/KaitCrawford/gists{/gist_id}","starred_url":"https://api.github.com/users/KaitCrawford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KaitCrawford/subscriptions","organizations_url":"https://api.github.com/users/KaitCrawford/orgs","repos_url":"https://api.github.com/users/KaitCrawford/repos","events_url":"https://api.github.com/users/KaitCrawford/events{/privacy}","received_events_url":"https://api.github.com/users/KaitCrawford/received_events","type":"User","site_admin":false},"body":null,"created_at":"2016-11-04T09:00:47Z","updated_at":"2016-11-28T08:21:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1cf00701fcfaddf408b773289788ad849a86980e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/praekelt/seed-message-sender/pulls/17/commits","review_comments_url":"https://api.github.com/repos/praekelt/seed-message-sender/pulls/17/comments","review_comment_url":"https://api.github.com/repos/praekelt/seed-message-sender/pulls/comments{/number}","comments_url":"https://api.github.com/repos/praekelt/seed-message-sender/issues/17/comments","statuses_url":"https://api.github.com/repos/praekelt/seed-message-sender/statuses/b9ce6678316e6e9df1eb48e2001dcc8e34aa739b","head":{"label":"praekelt:feature/SEED-649-concurrency-limiter","ref":"feature/SEED-649-concurrency-limiter","sha":"b9ce6678316e6e9df1eb48e2001dcc8e34aa739b","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":49590883,"name":"seed-message-sender","full_name":"praekelt/seed-message-sender","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/seed-message-sender","description":"Seed Message Sender and Message Store","fork":false,"url":"https://api.github.com/repos/praekelt/seed-message-sender","forks_url":"https://api.github.com/repos/praekelt/seed-message-sender/forks","keys_url":"https://api.github.com/repos/praekelt/seed-message-sender/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/seed-message-sender/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/seed-message-sender/teams","hooks_url":"https://api.github.com/repos/praekelt/seed-message-sender/hooks","issue_events_url":"https://api.github.com/repos/praekelt/seed-message-sender/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/seed-message-sender/events","assignees_url":"https://api.github.com/repos/praekelt/seed-message-sender/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/seed-message-sender/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/seed-message-sender/tags","blobs_url":"https://api.github.com/repos/praekelt/seed-message-sender/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/seed-message-sender/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/seed-message-sender/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/seed-message-sender/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/seed-message-sender/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/seed-message-sender/languages","stargazers_url":"https://api.github.com/repos/praekelt/seed-message-sender/stargazers","contributors_url":"https://api.github.com/repos/praekelt/seed-message-sender/contributors","subscribers_url":"https://api.github.com/repos/praekelt/seed-message-sender/subscribers","subscription_url":"https://api.github.com/repos/praekelt/seed-message-sender/subscription","commits_url":"https://api.github.com/repos/praekelt/seed-message-sender/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/seed-message-sender/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/seed-message-sender/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/seed-message-sender/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/seed-message-sender/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/seed-message-sender/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/seed-message-sender/merges","archive_url":"https://api.github.com/repos/praekelt/seed-message-sender/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/seed-message-sender/downloads","issues_url":"https://api.github.com/repos/praekelt/seed-message-sender/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/seed-message-sender/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/seed-message-sender/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/seed-message-sender/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/seed-message-sender/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/seed-message-sender/releases{/id}","deployments_url":"https://api.github.com/repos/praekelt/seed-message-sender/deployments","created_at":"2016-01-13T17:45:56Z","updated_at":"2016-03-16T15:20:21Z","pushed_at":"2016-11-25T15:16:51Z","git_url":"git://github.com/praekelt/seed-message-sender.git","ssh_url":"git@github.com:praekelt/seed-message-sender.git","clone_url":"https://github.com/praekelt/seed-message-sender.git","svn_url":"https://github.com/praekelt/seed-message-sender","homepage":null,"size":194,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":0,"default_branch":"develop"}},"base":{"label":"praekelt:develop","ref":"develop","sha":"383b852d681b20f724e16b63f551f4688c453ed0","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":49590883,"name":"seed-message-sender","full_name":"praekelt/seed-message-sender","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/seed-message-sender","description":"Seed Message Sender and Message Store","fork":false,"url":"https://api.github.com/repos/praekelt/seed-message-sender","forks_url":"https://api.github.com/repos/praekelt/seed-message-sender/forks","keys_url":"https://api.github.com/repos/praekelt/seed-message-sender/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/seed-message-sender/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/seed-message-sender/teams","hooks_url":"https://api.github.com/repos/praekelt/seed-message-sender/hooks","issue_events_url":"https://api.github.com/repos/praekelt/seed-message-sender/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/seed-message-sender/events","assignees_url":"https://api.github.com/repos/praekelt/seed-message-sender/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/seed-message-sender/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/seed-message-sender/tags","blobs_url":"https://api.github.com/repos/praekelt/seed-message-sender/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/seed-message-sender/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/seed-message-sender/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/seed-message-sender/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/seed-message-sender/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/seed-message-sender/languages","stargazers_url":"https://api.github.com/repos/praekelt/seed-message-sender/stargazers","contributors_url":"https://api.github.com/repos/praekelt/seed-message-sender/contributors","subscribers_url":"https://api.github.com/repos/praekelt/seed-message-sender/subscribers","subscription_url":"https://api.github.com/repos/praekelt/seed-message-sender/subscription","commits_url":"https://api.github.com/repos/praekelt/seed-message-sender/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/seed-message-sender/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/seed-message-sender/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/seed-message-sender/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/seed-message-sender/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/seed-message-sender/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/seed-message-sender/merges","archive_url":"https://api.github.com/repos/praekelt/seed-message-sender/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/seed-message-sender/downloads","issues_url":"https://api.github.com/repos/praekelt/seed-message-sender/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/seed-message-sender/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/seed-message-sender/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/seed-message-sender/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/seed-message-sender/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/seed-message-sender/releases{/id}","deployments_url":"https://api.github.com/repos/praekelt/seed-message-sender/deployments","created_at":"2016-01-13T17:45:56Z","updated_at":"2016-03-16T15:20:21Z","pushed_at":"2016-11-25T15:16:51Z","git_url":"git://github.com/praekelt/seed-message-sender.git","ssh_url":"git@github.com:praekelt/seed-message-sender.git","clone_url":"https://github.com/praekelt/seed-message-sender.git","svn_url":"https://github.com/praekelt/seed-message-sender","homepage":null,"size":194,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/praekelt/seed-message-sender/pulls/17"},"html":{"href":"https://github.com/praekelt/seed-message-sender/pull/17"},"issue":{"href":"https://api.github.com/repos/praekelt/seed-message-sender/issues/17"},"comments":{"href":"https://api.github.com/repos/praekelt/seed-message-sender/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/praekelt/seed-message-sender/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/praekelt/seed-message-sender/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/praekelt/seed-message-sender/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/praekelt/seed-message-sender/statuses/b9ce6678316e6e9df1eb48e2001dcc8e34aa739b"}}}}
{"actor":{"display_login":"rudigiesler"}}