{"action":"created","comment":{"url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/65137295","id":65137295,"diff_hunk":"@@ -793,31 +793,29 @@ def email_report(request, domain, report_slug, report_type=ProjectReportDispatch\n \n     config.filters = filters\n \n-    report_id = None\n+    report = None\n     if config.report:\n-        report_id = config.report._id\n-\n-    body = _render_report_configs(request, [config],\n-                                  domain,\n-                                  user_id, request.couch_user,\n-                                  True,\n-                                  lang=request.couch_user.language,\n-                                  notes=form.cleaned_data['notes'],\n-                                  once=once,\n-                                  report_id=report_id)[0].content\n+        report = config.report\n \n     subject = form.cleaned_data['subject'] or _(\"Email report from CommCare HQ\")\n+    content = _render_report_configs(\n+        request, [config], domain, user_id, request.couch_user, True, lang=request.couch_user.language,\n+        notes=form.cleaned_data['notes'], once=once\n+    )[0].content\n \n     if form.cleaned_data['send_to_owner']:\n-        send_html_email_async.delay(subject, request.couch_user.get_email(), body,\n-                                    email_from=settings.DEFAULT_FROM_EMAIL, ga_track=True,\n-                                    ga_tracking_info={'project_space_id': request.domain})\n+        email = request.couch_user.get_email()\n+        send_html_email_async.delay(\n+            subject, email, render_full_report_notification(request, content, email, report).content,","path":"corehq/apps/reports/views.py","position":49,"original_position":49,"commit_id":"d8e8ea1f9c4f7ccb021274293c6274f5c72af780","original_commit_id":"d8e8ea1f9c4f7ccb021274293c6274f5c72af780","user":{"login":"snopoke","id":249606,"avatar_url":"https://avatars.githubusercontent.com/u/249606?v=3","gravatar_id":"","url":"https://api.github.com/users/snopoke","html_url":"https://github.com/snopoke","followers_url":"https://api.github.com/users/snopoke/followers","following_url":"https://api.github.com/users/snopoke/following{/other_user}","gists_url":"https://api.github.com/users/snopoke/gists{/gist_id}","starred_url":"https://api.github.com/users/snopoke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snopoke/subscriptions","organizations_url":"https://api.github.com/users/snopoke/orgs","repos_url":"https://api.github.com/users/snopoke/repos","events_url":"https://api.github.com/users/snopoke/events{/privacy}","received_events_url":"https://api.github.com/users/snopoke/received_events","type":"User","site_admin":false},"body":"extracting `render_full_report_notification(request, content, email, report).content` to a variable would make this cleaner. Same below.","created_at":"2016-05-31T08:00:11Z","updated_at":"2016-05-31T08:00:11Z","html_url":"https://github.com/dimagi/commcare-hq/pull/11828#discussion_r65137295","pull_request_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/11828","_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/65137295"},"html":{"href":"https://github.com/dimagi/commcare-hq/pull/11828#discussion_r65137295"},"pull_request":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/11828"}}},"pull_request":{"url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/11828","id":71841620,"html_url":"https://github.com/dimagi/commcare-hq/pull/11828","diff_url":"https://github.com/dimagi/commcare-hq/pull/11828.diff","patch_url":"https://github.com/dimagi/commcare-hq/pull/11828.patch","issue_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/11828","number":11828,"state":"open","locked":false,"title":"226216-case: Unsubscribe from scheduled emails - updated functionality","user":{"login":"pnaw94","id":10995919,"avatar_url":"https://avatars.githubusercontent.com/u/10995919?v=3","gravatar_id":"","url":"https://api.github.com/users/pnaw94","html_url":"https://github.com/pnaw94","followers_url":"https://api.github.com/users/pnaw94/followers","following_url":"https://api.github.com/users/pnaw94/following{/other_user}","gists_url":"https://api.github.com/users/pnaw94/gists{/gist_id}","starred_url":"https://api.github.com/users/pnaw94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnaw94/subscriptions","organizations_url":"https://api.github.com/users/pnaw94/orgs","repos_url":"https://api.github.com/users/pnaw94/repos","events_url":"https://api.github.com/users/pnaw94/events{/privacy}","received_events_url":"https://api.github.com/users/pnaw94/received_events","type":"User","site_admin":false},"body":"@snopoke ","created_at":"2016-05-29T23:53:41Z","updated_at":"2016-05-31T08:00:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"06f3794085b20cd7ff3c865c29beb2bc5025b30e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/11828/commits","review_comments_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/11828/comments","review_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/11828/comments","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/d8e8ea1f9c4f7ccb021274293c6274f5c72af780","head":{"label":"lwyszomi:226216-case","ref":"226216-case","sha":"d8e8ea1f9c4f7ccb021274293c6274f5c72af780","user":{"login":"lwyszomi","id":429541,"avatar_url":"https://avatars.githubusercontent.com/u/429541?v=3","gravatar_id":"","url":"https://api.github.com/users/lwyszomi","html_url":"https://github.com/lwyszomi","followers_url":"https://api.github.com/users/lwyszomi/followers","following_url":"https://api.github.com/users/lwyszomi/following{/other_user}","gists_url":"https://api.github.com/users/lwyszomi/gists{/gist_id}","starred_url":"https://api.github.com/users/lwyszomi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lwyszomi/subscriptions","organizations_url":"https://api.github.com/users/lwyszomi/orgs","repos_url":"https://api.github.com/users/lwyszomi/repos","events_url":"https://api.github.com/users/lwyszomi/events{/privacy}","received_events_url":"https://api.github.com/users/lwyszomi/received_events","type":"User","site_admin":false},"repo":{"id":12557346,"name":"commcare-hq","full_name":"lwyszomi/commcare-hq","owner":{"login":"lwyszomi","id":429541,"avatar_url":"https://avatars.githubusercontent.com/u/429541?v=3","gravatar_id":"","url":"https://api.github.com/users/lwyszomi","html_url":"https://github.com/lwyszomi","followers_url":"https://api.github.com/users/lwyszomi/followers","following_url":"https://api.github.com/users/lwyszomi/following{/other_user}","gists_url":"https://api.github.com/users/lwyszomi/gists{/gist_id}","starred_url":"https://api.github.com/users/lwyszomi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lwyszomi/subscriptions","organizations_url":"https://api.github.com/users/lwyszomi/orgs","repos_url":"https://api.github.com/users/lwyszomi/repos","events_url":"https://api.github.com/users/lwyszomi/events{/privacy}","received_events_url":"https://api.github.com/users/lwyszomi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lwyszomi/commcare-hq","description":"A server-side tool to help manage community health workers, written in Django","fork":true,"url":"https://api.github.com/repos/lwyszomi/commcare-hq","forks_url":"https://api.github.com/repos/lwyszomi/commcare-hq/forks","keys_url":"https://api.github.com/repos/lwyszomi/commcare-hq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lwyszomi/commcare-hq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lwyszomi/commcare-hq/teams","hooks_url":"https://api.github.com/repos/lwyszomi/commcare-hq/hooks","issue_events_url":"https://api.github.com/repos/lwyszomi/commcare-hq/issues/events{/number}","events_url":"https://api.github.com/repos/lwyszomi/commcare-hq/events","assignees_url":"https://api.github.com/repos/lwyszomi/commcare-hq/assignees{/user}","branches_url":"https://api.github.com/repos/lwyszomi/commcare-hq/branches{/branch}","tags_url":"https://api.github.com/repos/lwyszomi/commcare-hq/tags","blobs_url":"https://api.github.com/repos/lwyszomi/commcare-hq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lwyszomi/commcare-hq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lwyszomi/commcare-hq/git/refs{/sha}","trees_url":"https://api.github.com/repos/lwyszomi/commcare-hq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lwyszomi/commcare-hq/statuses/{sha}","languages_url":"https://api.github.com/repos/lwyszomi/commcare-hq/languages","stargazers_url":"https://api.github.com/repos/lwyszomi/commcare-hq/stargazers","contributors_url":"https://api.github.com/repos/lwyszomi/commcare-hq/contributors","subscribers_url":"https://api.github.com/repos/lwyszomi/commcare-hq/subscribers","subscription_url":"https://api.github.com/repos/lwyszomi/commcare-hq/subscription","commits_url":"https://api.github.com/repos/lwyszomi/commcare-hq/commits{/sha}","git_commits_url":"https://api.github.com/repos/lwyszomi/commcare-hq/git/commits{/sha}","comments_url":"https://api.github.com/repos/lwyszomi/commcare-hq/comments{/number}","issue_comment_url":"https://api.github.com/repos/lwyszomi/commcare-hq/issues/comments{/number}","contents_url":"https://api.github.com/repos/lwyszomi/commcare-hq/contents/{+path}","compare_url":"https://api.github.com/repos/lwyszomi/commcare-hq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lwyszomi/commcare-hq/merges","archive_url":"https://api.github.com/repos/lwyszomi/commcare-hq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lwyszomi/commcare-hq/downloads","issues_url":"https://api.github.com/repos/lwyszomi/commcare-hq/issues{/number}","pulls_url":"https://api.github.com/repos/lwyszomi/commcare-hq/pulls{/number}","milestones_url":"https://api.github.com/repos/lwyszomi/commcare-hq/milestones{/number}","notifications_url":"https://api.github.com/repos/lwyszomi/commcare-hq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lwyszomi/commcare-hq/labels{/name}","releases_url":"https://api.github.com/repos/lwyszomi/commcare-hq/releases{/id}","deployments_url":"https://api.github.com/repos/lwyszomi/commcare-hq/deployments","created_at":"2013-09-03T07:05:35Z","updated_at":"2015-03-13T12:55:20Z","pushed_at":"2016-05-31T07:48:26Z","git_url":"git://github.com/lwyszomi/commcare-hq.git","ssh_url":"git@github.com:lwyszomi/commcare-hq.git","clone_url":"https://github.com/lwyszomi/commcare-hq.git","svn_url":"https://github.com/lwyszomi/commcare-hq","homepage":"http://www.commcarehq.org","size":233503,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dimagi:master","ref":"master","sha":"ae647965f9689de87038a27de274d5d40bacbfed","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":247278,"name":"commcare-hq","full_name":"dimagi/commcare-hq","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-hq","description":"A server-side tool to help manage community health workers, written in Django","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-hq","forks_url":"https://api.github.com/repos/dimagi/commcare-hq/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-hq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-hq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-hq/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-hq/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-hq/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-hq/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-hq/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-hq/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-hq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-hq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-hq/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-hq/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-hq/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-hq/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-hq/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-hq/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-hq/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/comments{/number}","contents_url":"https://api.github.com/repos/dimagi/commcare-hq/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-hq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-hq/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-hq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-hq/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-hq/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-hq/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-hq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-hq/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-hq/releases{/id}","deployments_url":"https://api.github.com/repos/dimagi/commcare-hq/deployments","created_at":"2009-07-09T17:00:07Z","updated_at":"2016-05-16T15:23:03Z","pushed_at":"2016-05-31T07:59:40Z","git_url":"git://github.com/dimagi/commcare-hq.git","ssh_url":"git@github.com:dimagi/commcare-hq.git","clone_url":"https://github.com/dimagi/commcare-hq.git","svn_url":"https://github.com/dimagi/commcare-hq","homepage":"http://www.commcarehq.org","size":297367,"stargazers_count":72,"watchers_count":72,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":68,"mirror_url":null,"open_issues_count":71,"forks":68,"open_issues":71,"watchers":72,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/11828"},"html":{"href":"https://github.com/dimagi/commcare-hq/pull/11828"},"issue":{"href":"https://api.github.com/repos/dimagi/commcare-hq/issues/11828"},"comments":{"href":"https://api.github.com/repos/dimagi/commcare-hq/issues/11828/comments"},"review_comments":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/11828/comments"},"review_comment":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/11828/commits"},"statuses":{"href":"https://api.github.com/repos/dimagi/commcare-hq/statuses/d8e8ea1f9c4f7ccb021274293c6274f5c72af780"}}}}
{"actor":{"display_login":"snopoke"}}