{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/kuma/pulls/comments/43684720","id":43684720,"diff_hunk":"@@ -2549,6 +2550,140 @@ def _check_message_for_headers(message, username):\n         _check_message_for_headers(testuser_message, 'testuser')\n         _check_message_for_headers(admin_message, 'admin')\n \n+    @attr('edit_emails')\n+    @mock.patch.object(Site.objects, 'get_current')\n+    def test_email_for_watched_edits(self, get_current):\n+        \"\"\"\n+        When a user edits a watched document, we should send an email to users\n+        who are watching it.\n+        \"\"\"\n+        get_current.return_value.domain = 'dev.mo.org'\n+        self.client.login(username='testuser', password='testpass')\n+        data = new_document_data()\n+        rev = revision(save=True)\n+\n+        testuser2 = get_user(username='testuser2')\n+        EditDocumentEvent.notify(testuser2, rev.document)\n+\n+        data.update({'form': 'rev',\n+                     'slug': rev.document.slug,\n+                     'title': rev.document.title,\n+                     'content': 'This edit should send an email',\n+                     'comment': 'This edit should send an email'})\n+        self.client.post(reverse('wiki.edit',\n+                                 args=[rev.document.slug]),\n+                         data)\n+        self.assertEquals(1, len(mail.outbox))\n+        message = mail.outbox[0]\n+        assert testuser2.email in message.to\n+        assert rev.document.title in message.body\n+        assert 'sub-articles' not in message.body\n+\n+        # Subscribe another user and assert 2 emails sent this time\n+        mail.outbox = []\n+        testuser01 = get_user(username='testuser01')\n+        EditDocumentEvent.notify(testuser01, rev.document)\n+\n+        data.update({'form': 'rev',\n+                     'slug': rev.document.slug,\n+                     'content': 'This edit should send 2 emails',\n+                     'comment': 'This edit should send 2 emails'})\n+        self.client.post(reverse('wiki.edit',\n+                                 args=[rev.document.slug]),\n+                         data)\n+        self.assertEquals(2, len(mail.outbox))\n+        message = mail.outbox[0]\n+        assert testuser2.email in message.to","path":"kuma/wiki/tests/test_views.py","position":68,"original_position":68,"commit_id":"c6f7345d4e15fc6a4dbf1be4d8a44ff4c8d8a640","original_commit_id":"c6f7345d4e15fc6a4dbf1be4d8a44ff4c8d8a640","user":{"login":"groovecoder","id":71928,"avatar_url":"https://avatars.githubusercontent.com/u/71928?v=3","gravatar_id":"","url":"https://api.github.com/users/groovecoder","html_url":"https://github.com/groovecoder","followers_url":"https://api.github.com/users/groovecoder/followers","following_url":"https://api.github.com/users/groovecoder/following{/other_user}","gists_url":"https://api.github.com/users/groovecoder/gists{/gist_id}","starred_url":"https://api.github.com/users/groovecoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groovecoder/subscriptions","organizations_url":"https://api.github.com/users/groovecoder/orgs","repos_url":"https://api.github.com/users/groovecoder/repos","events_url":"https://api.github.com/users/groovecoder/events{/privacy}","received_events_url":"https://api.github.com/users/groovecoder/received_events","type":"User","site_admin":false},"body":"In today's backend meeting we agreed to start removing nose assertion helpers to cut down on the different number of conventions in our tests. Going to leave this as-is unless/until we start removing native asserts.","created_at":"2015-11-02T21:25:56Z","updated_at":"2015-11-02T21:25:56Z","html_url":"https://github.com/mozilla/kuma/pull/3602#discussion_r43684720","pull_request_url":"https://api.github.com/repos/mozilla/kuma/pulls/3602","_links":{"self":{"href":"https://api.github.com/repos/mozilla/kuma/pulls/comments/43684720"},"html":{"href":"https://github.com/mozilla/kuma/pull/3602#discussion_r43684720"},"pull_request":{"href":"https://api.github.com/repos/mozilla/kuma/pulls/3602"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/kuma/pulls/3602","id":48800752,"html_url":"https://github.com/mozilla/kuma/pull/3602","diff_url":"https://github.com/mozilla/kuma/pull/3602.diff","patch_url":"https://github.com/mozilla/kuma/pull/3602.patch","issue_url":"https://api.github.com/repos/mozilla/kuma/issues/3602","number":3602,"state":"open","locked":false,"title":"Watch tree 842340","user":{"login":"groovecoder","id":71928,"avatar_url":"https://avatars.githubusercontent.com/u/71928?v=3","gravatar_id":"","url":"https://api.github.com/users/groovecoder","html_url":"https://github.com/groovecoder","followers_url":"https://api.github.com/users/groovecoder/followers","following_url":"https://api.github.com/users/groovecoder/following{/other_user}","gists_url":"https://api.github.com/users/groovecoder/gists{/gist_id}","starred_url":"https://api.github.com/users/groovecoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groovecoder/subscriptions","organizations_url":"https://api.github.com/users/groovecoder/orgs","repos_url":"https://api.github.com/users/groovecoder/repos","events_url":"https://api.github.com/users/groovecoder/events{/privacy}","received_events_url":"https://api.github.com/users/groovecoder/received_events","type":"User","site_admin":false},"body":"Spot-check instructions:\r\n\r\n1. Sign in\r\n2. Go to a doc with a sub-article\r\n3. Under the advanced menu, click the \"Subscribe to this article and all its sub-articles\"\r\n    * [x] Verify the subscription notification UI is correct\r\n4. Sign in as a different user\r\n5. Go to the sub-article\r\n6. Edit the sub-article\r\n7. Check the `./manage.py worker` console output.\r\n    * [x] Verify our notification email is sent to the user who subscribed to the article + sub-articles. E.g.:\r\n```\r\n...\r\nSubject: [MDN] Page \"groovechild\" changed by DavidWalshOS\r\nFrom: notifications@developer.mozilla.org\r\n...\r\n--\r\nYou are subscribed to edits on: User:groovecoder and all its sub-articles.\r\nUnsubscribe from these emails:\r\nhttps://example.com/unsubscribe/14?s=dCvbUfbpab\r\n```\r\nBONUS spot-check waffle flag:\r\n8. [Add a waffle flag](https://developer-local.allizom.org/admin/waffle/flag/add/) called `watch_menu` and activate it for a user\r\n9. Visit a doc with a sub-article as the user\r\n   * [x] Verify there's a new UI \"eye\" element with the Subscribe links inside\r\n\r\n* [x] Tests\r\n* [x] Analytics tracking for split-testing\r\n* [x] [Bug 1218448](https://bugzilla.mozilla.org/show_bug.cgi?id=1218448) - Subscribe to article: notification never dismisses\r\n* [x] Feedback from @stephaniehobson on this UI approach: moving all of the \"subscribe\" page items into their own page nav menu:\r\n![doc-watch-menu](https://cloud.githubusercontent.com/assets/71928/10743160/5bfc1008-7bff-11e5-8d9d-2a15ee3668ee.png)\r\n\r\nOn non-English pages, there are 3 items in the menu:\r\n\r\n![doc-watch-menu-fr](https://cloud.githubusercontent.com/assets/71928/10743191/83ea97a6-7bff-11e5-934c-2500019e69e3.png)\r\n","created_at":"2015-10-26T21:36:14Z","updated_at":"2015-11-02T21:25:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e11ef86dcb4dc7f236f66c51a947b29bcc6777d","assignee":{"login":"stephaniehobson","id":854701,"avatar_url":"https://avatars.githubusercontent.com/u/854701?v=3","gravatar_id":"","url":"https://api.github.com/users/stephaniehobson","html_url":"https://github.com/stephaniehobson","followers_url":"https://api.github.com/users/stephaniehobson/followers","following_url":"https://api.github.com/users/stephaniehobson/following{/other_user}","gists_url":"https://api.github.com/users/stephaniehobson/gists{/gist_id}","starred_url":"https://api.github.com/users/stephaniehobson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephaniehobson/subscriptions","organizations_url":"https://api.github.com/users/stephaniehobson/orgs","repos_url":"https://api.github.com/users/stephaniehobson/repos","events_url":"https://api.github.com/users/stephaniehobson/events{/privacy}","received_events_url":"https://api.github.com/users/stephaniehobson/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/kuma/pulls/3602/commits","review_comments_url":"https://api.github.com/repos/mozilla/kuma/pulls/3602/comments","review_comment_url":"https://api.github.com/repos/mozilla/kuma/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/kuma/issues/3602/comments","statuses_url":"https://api.github.com/repos/mozilla/kuma/statuses/c6f7345d4e15fc6a4dbf1be4d8a44ff4c8d8a640","head":{"label":"mozilla:watch-tree-842340","ref":"watch-tree-842340","sha":"c6f7345d4e15fc6a4dbf1be4d8a44ff4c8d8a640","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":1352520,"name":"kuma","full_name":"mozilla/kuma","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/kuma","description":"The Django project that powers MDN.","fork":false,"url":"https://api.github.com/repos/mozilla/kuma","forks_url":"https://api.github.com/repos/mozilla/kuma/forks","keys_url":"https://api.github.com/repos/mozilla/kuma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/kuma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/kuma/teams","hooks_url":"https://api.github.com/repos/mozilla/kuma/hooks","issue_events_url":"https://api.github.com/repos/mozilla/kuma/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/kuma/events","assignees_url":"https://api.github.com/repos/mozilla/kuma/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/kuma/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/kuma/tags","blobs_url":"https://api.github.com/repos/mozilla/kuma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/kuma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/kuma/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/kuma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/kuma/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/kuma/languages","stargazers_url":"https://api.github.com/repos/mozilla/kuma/stargazers","contributors_url":"https://api.github.com/repos/mozilla/kuma/contributors","subscribers_url":"https://api.github.com/repos/mozilla/kuma/subscribers","subscription_url":"https://api.github.com/repos/mozilla/kuma/subscription","commits_url":"https://api.github.com/repos/mozilla/kuma/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/kuma/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/kuma/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/kuma/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/kuma/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/kuma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/kuma/merges","archive_url":"https://api.github.com/repos/mozilla/kuma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/kuma/downloads","issues_url":"https://api.github.com/repos/mozilla/kuma/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/kuma/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/kuma/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/kuma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/kuma/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/kuma/releases{/id}","created_at":"2011-02-10T21:48:06Z","updated_at":"2015-11-02T18:15:43Z","pushed_at":"2015-11-02T19:52:51Z","git_url":"git://github.com/mozilla/kuma.git","ssh_url":"git@github.com:mozilla/kuma.git","clone_url":"https://github.com/mozilla/kuma.git","svn_url":"https://github.com/mozilla/kuma","homepage":"https://developer.mozilla.org","size":166681,"stargazers_count":662,"watchers_count":662,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":442,"mirror_url":null,"open_issues_count":14,"forks":442,"open_issues":14,"watchers":662,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"119ae6236fa10e14ebc5f2a6517f816e3619985f","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":1352520,"name":"kuma","full_name":"mozilla/kuma","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/kuma","description":"The Django project that powers MDN.","fork":false,"url":"https://api.github.com/repos/mozilla/kuma","forks_url":"https://api.github.com/repos/mozilla/kuma/forks","keys_url":"https://api.github.com/repos/mozilla/kuma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/kuma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/kuma/teams","hooks_url":"https://api.github.com/repos/mozilla/kuma/hooks","issue_events_url":"https://api.github.com/repos/mozilla/kuma/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/kuma/events","assignees_url":"https://api.github.com/repos/mozilla/kuma/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/kuma/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/kuma/tags","blobs_url":"https://api.github.com/repos/mozilla/kuma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/kuma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/kuma/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/kuma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/kuma/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/kuma/languages","stargazers_url":"https://api.github.com/repos/mozilla/kuma/stargazers","contributors_url":"https://api.github.com/repos/mozilla/kuma/contributors","subscribers_url":"https://api.github.com/repos/mozilla/kuma/subscribers","subscription_url":"https://api.github.com/repos/mozilla/kuma/subscription","commits_url":"https://api.github.com/repos/mozilla/kuma/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/kuma/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/kuma/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/kuma/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/kuma/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/kuma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/kuma/merges","archive_url":"https://api.github.com/repos/mozilla/kuma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/kuma/downloads","issues_url":"https://api.github.com/repos/mozilla/kuma/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/kuma/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/kuma/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/kuma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/kuma/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/kuma/releases{/id}","created_at":"2011-02-10T21:48:06Z","updated_at":"2015-11-02T18:15:43Z","pushed_at":"2015-11-02T19:52:51Z","git_url":"git://github.com/mozilla/kuma.git","ssh_url":"git@github.com:mozilla/kuma.git","clone_url":"https://github.com/mozilla/kuma.git","svn_url":"https://github.com/mozilla/kuma","homepage":"https://developer.mozilla.org","size":166681,"stargazers_count":662,"watchers_count":662,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":442,"mirror_url":null,"open_issues_count":14,"forks":442,"open_issues":14,"watchers":662,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/kuma/pulls/3602"},"html":{"href":"https://github.com/mozilla/kuma/pull/3602"},"issue":{"href":"https://api.github.com/repos/mozilla/kuma/issues/3602"},"comments":{"href":"https://api.github.com/repos/mozilla/kuma/issues/3602/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/kuma/pulls/3602/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/kuma/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/kuma/pulls/3602/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/kuma/statuses/c6f7345d4e15fc6a4dbf1be4d8a44ff4c8d8a640"}}}}