{"action":"created","comment":{"url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls/comments/176052162","pull_request_review_id":105684905,"id":176052162,"diff_hunk":"@@ -80,3 +81,36 @@ def test_create_suggested_post_lock(self):\n         self.assertEqual(suggested_lock.postextraelection.election.slug, '2015')\n         self.assertEqual(suggested_lock.user, self.user)\n         self.assertEqual(suggested_lock.justification, 'I liked totally reviewed the SOPN')\n+\n+    def test_post_lock_not_offered_when_user_suggested_lock(self):\n+        group = Group.objects.get(name=TRUSTED_TO_LOCK_GROUP_NAME)\n+        self.user.groups.add(group)\n+        self.user.save()\n+\n+        OfficialDocument.objects.create(\n+            election=self.election,\n+            post=self.edinburgh_east_post_extra.base,\n+            source_url='http://example.com',\n+            document_type=OfficialDocument.NOMINATION_PAPER,\n+            uploaded_file=\"sopn.pdf\"\n+        )\n+\n+        pee = PostExtraElection.objects.get(\n+            election__slug='2015',\n+            postextra__slug='14419',\n+        )\n+\n+        SuggestedPostLock.objects.create(\n+            postextraelection=pee,\n+            user=self.user,\n+            justification='I liked totally reviewed the SOPN',\n+        )\n+\n+        response = self.app.get(\n+            '/election/2015/post/14419/edinburgh-east',\n+            user=self.user,\n+        )\n+        self.assertContains(\n+            response,\n+            \"Locking disabled because you suggested locking this post\"\n+        )","path":"ynr/apps/elections/uk/tests/test_post_view.py","position":50,"original_position":50,"commit_id":"7f36c481dc1fa9ca1a8936ccc993864a484fa1ec","original_commit_id":"af71993fa302b85891c8c784e4f2c396b849c914","user":{"login":"symroe","id":242329,"avatar_url":"https://avatars0.githubusercontent.com/u/242329?v=4","gravatar_id":"","url":"https://api.github.com/users/symroe","html_url":"https://github.com/symroe","followers_url":"https://api.github.com/users/symroe/followers","following_url":"https://api.github.com/users/symroe/following{/other_user}","gists_url":"https://api.github.com/users/symroe/gists{/gist_id}","starred_url":"https://api.github.com/users/symroe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symroe/subscriptions","organizations_url":"https://api.github.com/users/symroe/orgs","repos_url":"https://api.github.com/users/symroe/repos","events_url":"https://api.github.com/users/symroe/events{/privacy}","received_events_url":"https://api.github.com/users/symroe/received_events","type":"User","site_admin":false},"body":"👍 ","created_at":"2018-03-21T11:36:34Z","updated_at":"2018-03-21T11:36:34Z","html_url":"https://github.com/DemocracyClub/yournextrepresentative/pull/438#discussion_r176052162","pull_request_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls/438","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls/comments/176052162"},"html":{"href":"https://github.com/DemocracyClub/yournextrepresentative/pull/438#discussion_r176052162"},"pull_request":{"href":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls/438"}},"in_reply_to_id":176018343},"pull_request":{"url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls/438","id":176321344,"html_url":"https://github.com/DemocracyClub/yournextrepresentative/pull/438","diff_url":"https://github.com/DemocracyClub/yournextrepresentative/pull/438.diff","patch_url":"https://github.com/DemocracyClub/yournextrepresentative/pull/438.patch","issue_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/issues/438","number":438,"state":"open","locked":false,"title":"Basic prevention of self-locking","user":{"login":"symroe","id":242329,"avatar_url":"https://avatars0.githubusercontent.com/u/242329?v=4","gravatar_id":"","url":"https://api.github.com/users/symroe","html_url":"https://github.com/symroe","followers_url":"https://api.github.com/users/symroe/followers","following_url":"https://api.github.com/users/symroe/following{/other_user}","gists_url":"https://api.github.com/users/symroe/gists{/gist_id}","starred_url":"https://api.github.com/users/symroe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symroe/subscriptions","organizations_url":"https://api.github.com/users/symroe/orgs","repos_url":"https://api.github.com/users/symroe/repos","events_url":"https://api.github.com/users/symroe/events{/privacy}","received_events_url":"https://api.github.com/users/symroe/received_events","type":"User","site_admin":false},"body":"Of course there are other ways to prevent this that are out of scope of\r\nthis PR.\r\n\r\nFor example, this doesn't cover the case where a user with locking\r\npermission has added all the candidates themselves but hasn't suggested\r\nlocking. This case is harder to detect.\r\n\r\nFor the time being, this should catch the most obvious cases of\r\nself-locking.\r\n\r\nCloses #312","created_at":"2018-03-20T21:01:35Z","updated_at":"2018-03-21T11:36:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f2371cedf0e18db41a2058e01f3025910e71b6c0","assignee":{"login":"symroe","id":242329,"avatar_url":"https://avatars0.githubusercontent.com/u/242329?v=4","gravatar_id":"","url":"https://api.github.com/users/symroe","html_url":"https://github.com/symroe","followers_url":"https://api.github.com/users/symroe/followers","following_url":"https://api.github.com/users/symroe/following{/other_user}","gists_url":"https://api.github.com/users/symroe/gists{/gist_id}","starred_url":"https://api.github.com/users/symroe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symroe/subscriptions","organizations_url":"https://api.github.com/users/symroe/orgs","repos_url":"https://api.github.com/users/symroe/repos","events_url":"https://api.github.com/users/symroe/events{/privacy}","received_events_url":"https://api.github.com/users/symroe/received_events","type":"User","site_admin":false},"assignees":[{"login":"symroe","id":242329,"avatar_url":"https://avatars0.githubusercontent.com/u/242329?v=4","gravatar_id":"","url":"https://api.github.com/users/symroe","html_url":"https://github.com/symroe","followers_url":"https://api.github.com/users/symroe/followers","following_url":"https://api.github.com/users/symroe/following{/other_user}","gists_url":"https://api.github.com/users/symroe/gists{/gist_id}","starred_url":"https://api.github.com/users/symroe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symroe/subscriptions","organizations_url":"https://api.github.com/users/symroe/orgs","repos_url":"https://api.github.com/users/symroe/repos","events_url":"https://api.github.com/users/symroe/events{/privacy}","received_events_url":"https://api.github.com/users/symroe/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":588238247,"url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/labels/4%20-%20Awaiting%20Review","name":"4 - Awaiting Review","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls/438/commits","review_comments_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls/438/comments","review_comment_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/issues/438/comments","statuses_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/statuses/7f36c481dc1fa9ca1a8936ccc993864a484fa1ec","head":{"label":"DemocracyClub:312-prevent-self-locking","ref":"312-prevent-self-locking","sha":"7f36c481dc1fa9ca1a8936ccc993864a484fa1ec","user":{"login":"DemocracyClub","id":6901194,"avatar_url":"https://avatars0.githubusercontent.com/u/6901194?v=4","gravatar_id":"","url":"https://api.github.com/users/DemocracyClub","html_url":"https://github.com/DemocracyClub","followers_url":"https://api.github.com/users/DemocracyClub/followers","following_url":"https://api.github.com/users/DemocracyClub/following{/other_user}","gists_url":"https://api.github.com/users/DemocracyClub/gists{/gist_id}","starred_url":"https://api.github.com/users/DemocracyClub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DemocracyClub/subscriptions","organizations_url":"https://api.github.com/users/DemocracyClub/orgs","repos_url":"https://api.github.com/users/DemocracyClub/repos","events_url":"https://api.github.com/users/DemocracyClub/events{/privacy}","received_events_url":"https://api.github.com/users/DemocracyClub/received_events","type":"Organization","site_admin":false},"repo":{"id":50421953,"name":"yournextrepresentative","full_name":"DemocracyClub/yournextrepresentative","owner":{"login":"DemocracyClub","id":6901194,"avatar_url":"https://avatars0.githubusercontent.com/u/6901194?v=4","gravatar_id":"","url":"https://api.github.com/users/DemocracyClub","html_url":"https://github.com/DemocracyClub","followers_url":"https://api.github.com/users/DemocracyClub/followers","following_url":"https://api.github.com/users/DemocracyClub/following{/other_user}","gists_url":"https://api.github.com/users/DemocracyClub/gists{/gist_id}","starred_url":"https://api.github.com/users/DemocracyClub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DemocracyClub/subscriptions","organizations_url":"https://api.github.com/users/DemocracyClub/orgs","repos_url":"https://api.github.com/users/DemocracyClub/repos","events_url":"https://api.github.com/users/DemocracyClub/events{/privacy}","received_events_url":"https://api.github.com/users/DemocracyClub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DemocracyClub/yournextrepresentative","description":"A website for crowd-sourcing structured election candidate data","fork":false,"url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative","forks_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/forks","keys_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/teams","hooks_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/hooks","issue_events_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/issues/events{/number}","events_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/events","assignees_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/assignees{/user}","branches_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/branches{/branch}","tags_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/tags","blobs_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/git/refs{/sha}","trees_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/statuses/{sha}","languages_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/languages","stargazers_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/stargazers","contributors_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/contributors","subscribers_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/subscribers","subscription_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/subscription","commits_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/commits{/sha}","git_commits_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/git/commits{/sha}","comments_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/comments{/number}","issue_comment_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/issues/comments{/number}","contents_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/contents/{+path}","compare_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/merges","archive_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/downloads","issues_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/issues{/number}","pulls_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls{/number}","milestones_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/milestones{/number}","notifications_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/labels{/name}","releases_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/releases{/id}","deployments_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/deployments","created_at":"2016-01-26T10:37:25Z","updated_at":"2018-03-20T11:53:59Z","pushed_at":"2018-03-21T11:36:21Z","git_url":"git://github.com/DemocracyClub/yournextrepresentative.git","ssh_url":"git@github.com:DemocracyClub/yournextrepresentative.git","clone_url":"https://github.com/DemocracyClub/yournextrepresentative.git","svn_url":"https://github.com/DemocracyClub/yournextrepresentative","homepage":"https://candidates.democracyclub.org.uk","size":8014,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":87,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":11,"open_issues":87,"watchers":7,"default_branch":"master"}},"base":{"label":"DemocracyClub:master","ref":"master","sha":"161e030f478fd0e89700130c4d0b91873ca43420","user":{"login":"DemocracyClub","id":6901194,"avatar_url":"https://avatars0.githubusercontent.com/u/6901194?v=4","gravatar_id":"","url":"https://api.github.com/users/DemocracyClub","html_url":"https://github.com/DemocracyClub","followers_url":"https://api.github.com/users/DemocracyClub/followers","following_url":"https://api.github.com/users/DemocracyClub/following{/other_user}","gists_url":"https://api.github.com/users/DemocracyClub/gists{/gist_id}","starred_url":"https://api.github.com/users/DemocracyClub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DemocracyClub/subscriptions","organizations_url":"https://api.github.com/users/DemocracyClub/orgs","repos_url":"https://api.github.com/users/DemocracyClub/repos","events_url":"https://api.github.com/users/DemocracyClub/events{/privacy}","received_events_url":"https://api.github.com/users/DemocracyClub/received_events","type":"Organization","site_admin":false},"repo":{"id":50421953,"name":"yournextrepresentative","full_name":"DemocracyClub/yournextrepresentative","owner":{"login":"DemocracyClub","id":6901194,"avatar_url":"https://avatars0.githubusercontent.com/u/6901194?v=4","gravatar_id":"","url":"https://api.github.com/users/DemocracyClub","html_url":"https://github.com/DemocracyClub","followers_url":"https://api.github.com/users/DemocracyClub/followers","following_url":"https://api.github.com/users/DemocracyClub/following{/other_user}","gists_url":"https://api.github.com/users/DemocracyClub/gists{/gist_id}","starred_url":"https://api.github.com/users/DemocracyClub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DemocracyClub/subscriptions","organizations_url":"https://api.github.com/users/DemocracyClub/orgs","repos_url":"https://api.github.com/users/DemocracyClub/repos","events_url":"https://api.github.com/users/DemocracyClub/events{/privacy}","received_events_url":"https://api.github.com/users/DemocracyClub/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DemocracyClub/yournextrepresentative","description":"A website for crowd-sourcing structured election candidate data","fork":false,"url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative","forks_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/forks","keys_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/teams","hooks_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/hooks","issue_events_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/issues/events{/number}","events_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/events","assignees_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/assignees{/user}","branches_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/branches{/branch}","tags_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/tags","blobs_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/git/refs{/sha}","trees_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/statuses/{sha}","languages_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/languages","stargazers_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/stargazers","contributors_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/contributors","subscribers_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/subscribers","subscription_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/subscription","commits_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/commits{/sha}","git_commits_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/git/commits{/sha}","comments_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/comments{/number}","issue_comment_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/issues/comments{/number}","contents_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/contents/{+path}","compare_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/merges","archive_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/downloads","issues_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/issues{/number}","pulls_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls{/number}","milestones_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/milestones{/number}","notifications_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/labels{/name}","releases_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/releases{/id}","deployments_url":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/deployments","created_at":"2016-01-26T10:37:25Z","updated_at":"2018-03-20T11:53:59Z","pushed_at":"2018-03-21T11:36:21Z","git_url":"git://github.com/DemocracyClub/yournextrepresentative.git","ssh_url":"git@github.com:DemocracyClub/yournextrepresentative.git","clone_url":"https://github.com/DemocracyClub/yournextrepresentative.git","svn_url":"https://github.com/DemocracyClub/yournextrepresentative","homepage":"https://candidates.democracyclub.org.uk","size":8014,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":87,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":11,"open_issues":87,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls/438"},"html":{"href":"https://github.com/DemocracyClub/yournextrepresentative/pull/438"},"issue":{"href":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/issues/438"},"comments":{"href":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/issues/438/comments"},"review_comments":{"href":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls/438/comments"},"review_comment":{"href":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/pulls/438/commits"},"statuses":{"href":"https://api.github.com/repos/DemocracyClub/yournextrepresentative/statuses/7f36c481dc1fa9ca1a8936ccc993864a484fa1ec"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"symroe"}}