{"action":"created","comment":{"url":"https://api.github.com/repos/zestedesavoir/zds-site/pulls/comments/87586061","pull_request_review_id":8194194,"id":87586061,"diff_hunk":"@@ -206,15 +207,20 @@ def mark_notification_read(self, content):\n             raise Exception('Object content of notification must be defined')\n \n         content_notification_type = ContentType.objects.get_for_model(content)\n-        try:\n-            notification = Notification.objects.get(subscription=self,\n-                                                    content_type__pk=content_notification_type.pk,\n-                                                    object_id=content.pk, is_read=False)\n-            if notification is not None:\n-                notification.is_read = True\n-                notification.save()\n-        except Notification.DoesNotExist:\n-            pass\n+        notifications = list(Notification.objects.filter(subscription=self,\n+                                                         content_type__pk=content_notification_type.pk,\n+                                                         object_id=content.pk, is_read=False))\n+        # for some reason, it appears that some notification can be subscribed twice.\n+        if len(notifications) == 0:","path":"zds/notification/models.py","position":23,"original_position":23,"commit_id":"42c4cab2977cd08598a78c9656fdbcc4778764e3","original_commit_id":"42c4cab2977cd08598a78c9656fdbcc4778764e3","user":{"login":"vhf","id":2022803,"avatar_url":"https://avatars.githubusercontent.com/u/2022803?v=3","gravatar_id":"","url":"https://api.github.com/users/vhf","html_url":"https://github.com/vhf","followers_url":"https://api.github.com/users/vhf/followers","following_url":"https://api.github.com/users/vhf/following{/other_user}","gists_url":"https://api.github.com/users/vhf/gists{/gist_id}","starred_url":"https://api.github.com/users/vhf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vhf/subscriptions","organizations_url":"https://api.github.com/users/vhf/orgs","repos_url":"https://api.github.com/users/vhf/repos","events_url":"https://api.github.com/users/vhf/events{/privacy}","received_events_url":"https://api.github.com/users/vhf/received_events","type":"User","site_admin":false},"body":"`if not notifications:` serait idiomatique.","created_at":"2016-11-11T13:14:58Z","updated_at":"2016-11-11T13:16:20Z","html_url":"https://github.com/zestedesavoir/zds-site/pull/3954#discussion_r87586061","pull_request_url":"https://api.github.com/repos/zestedesavoir/zds-site/pulls/3954","_links":{"self":{"href":"https://api.github.com/repos/zestedesavoir/zds-site/pulls/comments/87586061"},"html":{"href":"https://github.com/zestedesavoir/zds-site/pull/3954#discussion_r87586061"},"pull_request":{"href":"https://api.github.com/repos/zestedesavoir/zds-site/pulls/3954"}}},"pull_request":{"url":"https://api.github.com/repos/zestedesavoir/zds-site/pulls/3954","id":93144643,"html_url":"https://github.com/zestedesavoir/zds-site/pull/3954","diff_url":"https://github.com/zestedesavoir/zds-site/pull/3954.diff","patch_url":"https://github.com/zestedesavoir/zds-site/pull/3954.patch","issue_url":"https://api.github.com/repos/zestedesavoir/zds-site/issues/3954","number":3954,"state":"open","locked":false,"title":"Plus de double souscription","user":{"login":"artragis","id":1523653,"avatar_url":"https://avatars.githubusercontent.com/u/1523653?v=3","gravatar_id":"","url":"https://api.github.com/users/artragis","html_url":"https://github.com/artragis","followers_url":"https://api.github.com/users/artragis/followers","following_url":"https://api.github.com/users/artragis/following{/other_user}","gists_url":"https://api.github.com/users/artragis/gists{/gist_id}","starred_url":"https://api.github.com/users/artragis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artragis/subscriptions","organizations_url":"https://api.github.com/users/artragis/orgs","repos_url":"https://api.github.com/users/artragis/repos","events_url":"https://api.github.com/users/artragis/events{/privacy}","received_events_url":"https://api.github.com/users/artragis/received_events","type":"User","site_admin":false},"body":"| Q                                   | R\r\n| ----------------------------------- | -------------------------------------------\r\n| Type de modification                | correction de bug \r\n| Ticket(s) (_issue(s)_) concerné(s)  | #3918\r\n\r\nLe test unitaire arrive.\r\n\r\n### QA\r\n\r\n* je ne sais pas comment ce bug est arrivé là, il va donc falloir créer une notification double avec le django shell, sorry.\r\n\r\n\r\n","created_at":"2016-11-10T12:50:07Z","updated_at":"2016-11-11T13:16:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c048d1bcfc25e733279a126fdeb526ffb6504084","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zestedesavoir/zds-site/pulls/3954/commits","review_comments_url":"https://api.github.com/repos/zestedesavoir/zds-site/pulls/3954/comments","review_comment_url":"https://api.github.com/repos/zestedesavoir/zds-site/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zestedesavoir/zds-site/issues/3954/comments","statuses_url":"https://api.github.com/repos/zestedesavoir/zds-site/statuses/42c4cab2977cd08598a78c9656fdbcc4778764e3","head":{"label":"artragis:fix_3918","ref":"fix_3918","sha":"42c4cab2977cd08598a78c9656fdbcc4778764e3","user":{"login":"artragis","id":1523653,"avatar_url":"https://avatars.githubusercontent.com/u/1523653?v=3","gravatar_id":"","url":"https://api.github.com/users/artragis","html_url":"https://github.com/artragis","followers_url":"https://api.github.com/users/artragis/followers","following_url":"https://api.github.com/users/artragis/following{/other_user}","gists_url":"https://api.github.com/users/artragis/gists{/gist_id}","starred_url":"https://api.github.com/users/artragis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artragis/subscriptions","organizations_url":"https://api.github.com/users/artragis/orgs","repos_url":"https://api.github.com/users/artragis/repos","events_url":"https://api.github.com/users/artragis/events{/privacy}","received_events_url":"https://api.github.com/users/artragis/received_events","type":"User","site_admin":false},"repo":{"id":20302770,"name":"zds-site","full_name":"artragis/zds-site","owner":{"login":"artragis","id":1523653,"avatar_url":"https://avatars.githubusercontent.com/u/1523653?v=3","gravatar_id":"","url":"https://api.github.com/users/artragis","html_url":"https://github.com/artragis","followers_url":"https://api.github.com/users/artragis/followers","following_url":"https://api.github.com/users/artragis/following{/other_user}","gists_url":"https://api.github.com/users/artragis/gists{/gist_id}","starred_url":"https://api.github.com/users/artragis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artragis/subscriptions","organizations_url":"https://api.github.com/users/artragis/orgs","repos_url":"https://api.github.com/users/artragis/repos","events_url":"https://api.github.com/users/artragis/events{/privacy}","received_events_url":"https://api.github.com/users/artragis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/artragis/zds-site","description":"Dépot ZDS","fork":true,"url":"https://api.github.com/repos/artragis/zds-site","forks_url":"https://api.github.com/repos/artragis/zds-site/forks","keys_url":"https://api.github.com/repos/artragis/zds-site/keys{/key_id}","collaborators_url":"https://api.github.com/repos/artragis/zds-site/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/artragis/zds-site/teams","hooks_url":"https://api.github.com/repos/artragis/zds-site/hooks","issue_events_url":"https://api.github.com/repos/artragis/zds-site/issues/events{/number}","events_url":"https://api.github.com/repos/artragis/zds-site/events","assignees_url":"https://api.github.com/repos/artragis/zds-site/assignees{/user}","branches_url":"https://api.github.com/repos/artragis/zds-site/branches{/branch}","tags_url":"https://api.github.com/repos/artragis/zds-site/tags","blobs_url":"https://api.github.com/repos/artragis/zds-site/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/artragis/zds-site/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/artragis/zds-site/git/refs{/sha}","trees_url":"https://api.github.com/repos/artragis/zds-site/git/trees{/sha}","statuses_url":"https://api.github.com/repos/artragis/zds-site/statuses/{sha}","languages_url":"https://api.github.com/repos/artragis/zds-site/languages","stargazers_url":"https://api.github.com/repos/artragis/zds-site/stargazers","contributors_url":"https://api.github.com/repos/artragis/zds-site/contributors","subscribers_url":"https://api.github.com/repos/artragis/zds-site/subscribers","subscription_url":"https://api.github.com/repos/artragis/zds-site/subscription","commits_url":"https://api.github.com/repos/artragis/zds-site/commits{/sha}","git_commits_url":"https://api.github.com/repos/artragis/zds-site/git/commits{/sha}","comments_url":"https://api.github.com/repos/artragis/zds-site/comments{/number}","issue_comment_url":"https://api.github.com/repos/artragis/zds-site/issues/comments{/number}","contents_url":"https://api.github.com/repos/artragis/zds-site/contents/{+path}","compare_url":"https://api.github.com/repos/artragis/zds-site/compare/{base}...{head}","merges_url":"https://api.github.com/repos/artragis/zds-site/merges","archive_url":"https://api.github.com/repos/artragis/zds-site/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/artragis/zds-site/downloads","issues_url":"https://api.github.com/repos/artragis/zds-site/issues{/number}","pulls_url":"https://api.github.com/repos/artragis/zds-site/pulls{/number}","milestones_url":"https://api.github.com/repos/artragis/zds-site/milestones{/number}","notifications_url":"https://api.github.com/repos/artragis/zds-site/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/artragis/zds-site/labels{/name}","releases_url":"https://api.github.com/repos/artragis/zds-site/releases{/id}","deployments_url":"https://api.github.com/repos/artragis/zds-site/deployments","created_at":"2014-05-29T17:51:23Z","updated_at":"2016-01-11T12:09:06Z","pushed_at":"2016-11-11T13:16:03Z","git_url":"git://github.com/artragis/zds-site.git","ssh_url":"git@github.com:artragis/zds-site.git","clone_url":"https://github.com/artragis/zds-site.git","svn_url":"https://github.com/artragis/zds-site","homepage":null,"size":100212,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":0,"default_branch":"dev_zep_8.1"}},"base":{"label":"zestedesavoir:dev","ref":"dev","sha":"21eb396cfe4904b09f76aac770baf49b21dac6d2","user":{"login":"zestedesavoir","id":7406239,"avatar_url":"https://avatars.githubusercontent.com/u/7406239?v=3","gravatar_id":"","url":"https://api.github.com/users/zestedesavoir","html_url":"https://github.com/zestedesavoir","followers_url":"https://api.github.com/users/zestedesavoir/followers","following_url":"https://api.github.com/users/zestedesavoir/following{/other_user}","gists_url":"https://api.github.com/users/zestedesavoir/gists{/gist_id}","starred_url":"https://api.github.com/users/zestedesavoir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zestedesavoir/subscriptions","organizations_url":"https://api.github.com/users/zestedesavoir/orgs","repos_url":"https://api.github.com/users/zestedesavoir/repos","events_url":"https://api.github.com/users/zestedesavoir/events{/privacy}","received_events_url":"https://api.github.com/users/zestedesavoir/received_events","type":"Organization","site_admin":false},"repo":{"id":14778920,"name":"zds-site","full_name":"zestedesavoir/zds-site","owner":{"login":"zestedesavoir","id":7406239,"avatar_url":"https://avatars.githubusercontent.com/u/7406239?v=3","gravatar_id":"","url":"https://api.github.com/users/zestedesavoir","html_url":"https://github.com/zestedesavoir","followers_url":"https://api.github.com/users/zestedesavoir/followers","following_url":"https://api.github.com/users/zestedesavoir/following{/other_user}","gists_url":"https://api.github.com/users/zestedesavoir/gists{/gist_id}","starred_url":"https://api.github.com/users/zestedesavoir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zestedesavoir/subscriptions","organizations_url":"https://api.github.com/users/zestedesavoir/orgs","repos_url":"https://api.github.com/users/zestedesavoir/repos","events_url":"https://api.github.com/users/zestedesavoir/events{/privacy}","received_events_url":"https://api.github.com/users/zestedesavoir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zestedesavoir/zds-site","description":"Dépôt de ZdS, faisant notamment fonctionner https://zestedesavoir.com","fork":false,"url":"https://api.github.com/repos/zestedesavoir/zds-site","forks_url":"https://api.github.com/repos/zestedesavoir/zds-site/forks","keys_url":"https://api.github.com/repos/zestedesavoir/zds-site/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zestedesavoir/zds-site/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zestedesavoir/zds-site/teams","hooks_url":"https://api.github.com/repos/zestedesavoir/zds-site/hooks","issue_events_url":"https://api.github.com/repos/zestedesavoir/zds-site/issues/events{/number}","events_url":"https://api.github.com/repos/zestedesavoir/zds-site/events","assignees_url":"https://api.github.com/repos/zestedesavoir/zds-site/assignees{/user}","branches_url":"https://api.github.com/repos/zestedesavoir/zds-site/branches{/branch}","tags_url":"https://api.github.com/repos/zestedesavoir/zds-site/tags","blobs_url":"https://api.github.com/repos/zestedesavoir/zds-site/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zestedesavoir/zds-site/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zestedesavoir/zds-site/git/refs{/sha}","trees_url":"https://api.github.com/repos/zestedesavoir/zds-site/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zestedesavoir/zds-site/statuses/{sha}","languages_url":"https://api.github.com/repos/zestedesavoir/zds-site/languages","stargazers_url":"https://api.github.com/repos/zestedesavoir/zds-site/stargazers","contributors_url":"https://api.github.com/repos/zestedesavoir/zds-site/contributors","subscribers_url":"https://api.github.com/repos/zestedesavoir/zds-site/subscribers","subscription_url":"https://api.github.com/repos/zestedesavoir/zds-site/subscription","commits_url":"https://api.github.com/repos/zestedesavoir/zds-site/commits{/sha}","git_commits_url":"https://api.github.com/repos/zestedesavoir/zds-site/git/commits{/sha}","comments_url":"https://api.github.com/repos/zestedesavoir/zds-site/comments{/number}","issue_comment_url":"https://api.github.com/repos/zestedesavoir/zds-site/issues/comments{/number}","contents_url":"https://api.github.com/repos/zestedesavoir/zds-site/contents/{+path}","compare_url":"https://api.github.com/repos/zestedesavoir/zds-site/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zestedesavoir/zds-site/merges","archive_url":"https://api.github.com/repos/zestedesavoir/zds-site/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zestedesavoir/zds-site/downloads","issues_url":"https://api.github.com/repos/zestedesavoir/zds-site/issues{/number}","pulls_url":"https://api.github.com/repos/zestedesavoir/zds-site/pulls{/number}","milestones_url":"https://api.github.com/repos/zestedesavoir/zds-site/milestones{/number}","notifications_url":"https://api.github.com/repos/zestedesavoir/zds-site/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zestedesavoir/zds-site/labels{/name}","releases_url":"https://api.github.com/repos/zestedesavoir/zds-site/releases{/id}","deployments_url":"https://api.github.com/repos/zestedesavoir/zds-site/deployments","created_at":"2013-11-28T14:23:48Z","updated_at":"2016-11-10T23:41:20Z","pushed_at":"2016-11-11T13:16:03Z","git_url":"git://github.com/zestedesavoir/zds-site.git","ssh_url":"git@github.com:zestedesavoir/zds-site.git","clone_url":"https://github.com/zestedesavoir/zds-site.git","svn_url":"https://github.com/zestedesavoir/zds-site","homepage":"","size":174896,"stargazers_count":169,"watchers_count":169,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":130,"mirror_url":null,"open_issues_count":235,"forks":130,"open_issues":235,"watchers":169,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/zestedesavoir/zds-site/pulls/3954"},"html":{"href":"https://github.com/zestedesavoir/zds-site/pull/3954"},"issue":{"href":"https://api.github.com/repos/zestedesavoir/zds-site/issues/3954"},"comments":{"href":"https://api.github.com/repos/zestedesavoir/zds-site/issues/3954/comments"},"review_comments":{"href":"https://api.github.com/repos/zestedesavoir/zds-site/pulls/3954/comments"},"review_comment":{"href":"https://api.github.com/repos/zestedesavoir/zds-site/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zestedesavoir/zds-site/pulls/3954/commits"},"statuses":{"href":"https://api.github.com/repos/zestedesavoir/zds-site/statuses/42c4cab2977cd08598a78c9656fdbcc4778764e3"}}}}
{"actor":{"display_login":"vhf"}}