{"action":"created","comment":{"url":"https://api.github.com/repos/wagtail/wagtail/pulls/comments/156206816","pull_request_review_id":82642726,"id":156206816,"diff_hunk":"@@ -43,5 +81,30 @@ def get_preferred_language(self):\n     def __str__(self):\n         return self.user.get_username()\n \n+    @cached_property\n+    def default_avatar(self):\n+        return static('wagtailadmin/images/default-user-avatar.svg')\n+\n+    def get_avatar_url(self, size=50):\n+        if self.avatar_choice == self.DEFAULT:\n+            return self.default_avatar\n+\n+        if self.avatar_choice == self.CUSTOM:\n+            try:\n+                return self.avatar.url\n+            except ValueError:\n+                return self.default_avatar\n+\n+        if self.avatar_choice == self.GRAVATAR and self.user.email:\n+            return get_gravatar_url(self.user.email, default=None, size=50)\n+\n+        return self.default_avatar\n+\n+    def save(self, *args, **kwargs):\n+        if self.avatar:\n+            this = UserProfile.objects.get(pk=self.pk)\n+            this.avatar.delete(save=False)","path":"wagtail/users/models.py","position":81,"original_position":81,"commit_id":"7476bf79e760ebe403d0e286bce3d2dc250afa74","original_commit_id":"7476bf79e760ebe403d0e286bce3d2dc250afa74","user":{"login":"m1kola","id":509198,"avatar_url":"https://avatars1.githubusercontent.com/u/509198?v=4","gravatar_id":"","url":"https://api.github.com/users/m1kola","html_url":"https://github.com/m1kola","followers_url":"https://api.github.com/users/m1kola/followers","following_url":"https://api.github.com/users/m1kola/following{/other_user}","gists_url":"https://api.github.com/users/m1kola/gists{/gist_id}","starred_url":"https://api.github.com/users/m1kola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m1kola/subscriptions","organizations_url":"https://api.github.com/users/m1kola/orgs","repos_url":"https://api.github.com/users/m1kola/repos","events_url":"https://api.github.com/users/m1kola/events{/privacy}","received_events_url":"https://api.github.com/users/m1kola/received_events","type":"User","site_admin":false},"body":"Probably it's not very critical, but there is a (small) chance that we will delete a file, but something will fail in the parent `save` method. So we will have a link to the old avatar file in the database, but we would not be able to recover a file.","created_at":"2017-12-11T21:39:30Z","updated_at":"2017-12-11T21:43:13Z","html_url":"https://github.com/wagtail/wagtail/pull/4062#discussion_r156206816","pull_request_url":"https://api.github.com/repos/wagtail/wagtail/pulls/4062","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/wagtail/wagtail/pulls/comments/156206816"},"html":{"href":"https://github.com/wagtail/wagtail/pull/4062#discussion_r156206816"},"pull_request":{"href":"https://api.github.com/repos/wagtail/wagtail/pulls/4062"}}},"pull_request":{"url":"https://api.github.com/repos/wagtail/wagtail/pulls/4062","id":154564804,"html_url":"https://github.com/wagtail/wagtail/pull/4062","diff_url":"https://github.com/wagtail/wagtail/pull/4062.diff","patch_url":"https://github.com/wagtail/wagtail/pull/4062.patch","issue_url":"https://api.github.com/repos/wagtail/wagtail/issues/4062","number":4062,"state":"open","locked":false,"title":"319 make gravatar optional","user":{"login":"willbarton","id":10562538,"avatar_url":"https://avatars0.githubusercontent.com/u/10562538?v=4","gravatar_id":"","url":"https://api.github.com/users/willbarton","html_url":"https://github.com/willbarton","followers_url":"https://api.github.com/users/willbarton/followers","following_url":"https://api.github.com/users/willbarton/following{/other_user}","gists_url":"https://api.github.com/users/willbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/willbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willbarton/subscriptions","organizations_url":"https://api.github.com/users/willbarton/orgs","repos_url":"https://api.github.com/users/willbarton/repos","events_url":"https://api.github.com/users/willbarton/events{/privacy}","received_events_url":"https://api.github.com/users/willbarton/received_events","type":"User","site_admin":false},"body":"Fixes #319 and #1289, supersedes #3424.\r\n\r\nThis is a continuation of @chimeno's work in https://github.com/wagtail/wagtail/pull/3424. I have:\r\n\r\n- Rebased @chimeno's work on current master and addressed all conflicts\r\n- Changed all instances of `gravatar_url` in the admin templates\r\n\r\nPreview images (from #3424, still relevant):\r\n\r\n![image](https://cloud.githubusercontent.com/assets/406515/23579814/c13693c2-00f5-11e7-9bfa-9a170e33f789.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/406515/23579835/0bb47590-00f6-11e7-9433-ca7ca55ea633.png)","created_at":"2017-11-24T14:55:59Z","updated_at":"2017-12-11T21:43:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e666ece4cb980c50f18a7282a86ad68315cc1fb9","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/wagtail/wagtail/pulls/4062/commits","review_comments_url":"https://api.github.com/repos/wagtail/wagtail/pulls/4062/comments","review_comment_url":"https://api.github.com/repos/wagtail/wagtail/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wagtail/wagtail/issues/4062/comments","statuses_url":"https://api.github.com/repos/wagtail/wagtail/statuses/7476bf79e760ebe403d0e286bce3d2dc250afa74","head":{"label":"willbarton:319_make_gravatar_optional","ref":"319_make_gravatar_optional","sha":"7476bf79e760ebe403d0e286bce3d2dc250afa74","user":{"login":"willbarton","id":10562538,"avatar_url":"https://avatars0.githubusercontent.com/u/10562538?v=4","gravatar_id":"","url":"https://api.github.com/users/willbarton","html_url":"https://github.com/willbarton","followers_url":"https://api.github.com/users/willbarton/followers","following_url":"https://api.github.com/users/willbarton/following{/other_user}","gists_url":"https://api.github.com/users/willbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/willbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willbarton/subscriptions","organizations_url":"https://api.github.com/users/willbarton/orgs","repos_url":"https://api.github.com/users/willbarton/repos","events_url":"https://api.github.com/users/willbarton/events{/privacy}","received_events_url":"https://api.github.com/users/willbarton/received_events","type":"User","site_admin":false},"repo":{"id":105017569,"name":"wagtail","full_name":"willbarton/wagtail","owner":{"login":"willbarton","id":10562538,"avatar_url":"https://avatars0.githubusercontent.com/u/10562538?v=4","gravatar_id":"","url":"https://api.github.com/users/willbarton","html_url":"https://github.com/willbarton","followers_url":"https://api.github.com/users/willbarton/followers","following_url":"https://api.github.com/users/willbarton/following{/other_user}","gists_url":"https://api.github.com/users/willbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/willbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willbarton/subscriptions","organizations_url":"https://api.github.com/users/willbarton/orgs","repos_url":"https://api.github.com/users/willbarton/repos","events_url":"https://api.github.com/users/willbarton/events{/privacy}","received_events_url":"https://api.github.com/users/willbarton/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/willbarton/wagtail","description":"A Django content management system focused on flexibility and user experience","fork":true,"url":"https://api.github.com/repos/willbarton/wagtail","forks_url":"https://api.github.com/repos/willbarton/wagtail/forks","keys_url":"https://api.github.com/repos/willbarton/wagtail/keys{/key_id}","collaborators_url":"https://api.github.com/repos/willbarton/wagtail/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/willbarton/wagtail/teams","hooks_url":"https://api.github.com/repos/willbarton/wagtail/hooks","issue_events_url":"https://api.github.com/repos/willbarton/wagtail/issues/events{/number}","events_url":"https://api.github.com/repos/willbarton/wagtail/events","assignees_url":"https://api.github.com/repos/willbarton/wagtail/assignees{/user}","branches_url":"https://api.github.com/repos/willbarton/wagtail/branches{/branch}","tags_url":"https://api.github.com/repos/willbarton/wagtail/tags","blobs_url":"https://api.github.com/repos/willbarton/wagtail/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/willbarton/wagtail/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/willbarton/wagtail/git/refs{/sha}","trees_url":"https://api.github.com/repos/willbarton/wagtail/git/trees{/sha}","statuses_url":"https://api.github.com/repos/willbarton/wagtail/statuses/{sha}","languages_url":"https://api.github.com/repos/willbarton/wagtail/languages","stargazers_url":"https://api.github.com/repos/willbarton/wagtail/stargazers","contributors_url":"https://api.github.com/repos/willbarton/wagtail/contributors","subscribers_url":"https://api.github.com/repos/willbarton/wagtail/subscribers","subscription_url":"https://api.github.com/repos/willbarton/wagtail/subscription","commits_url":"https://api.github.com/repos/willbarton/wagtail/commits{/sha}","git_commits_url":"https://api.github.com/repos/willbarton/wagtail/git/commits{/sha}","comments_url":"https://api.github.com/repos/willbarton/wagtail/comments{/number}","issue_comment_url":"https://api.github.com/repos/willbarton/wagtail/issues/comments{/number}","contents_url":"https://api.github.com/repos/willbarton/wagtail/contents/{+path}","compare_url":"https://api.github.com/repos/willbarton/wagtail/compare/{base}...{head}","merges_url":"https://api.github.com/repos/willbarton/wagtail/merges","archive_url":"https://api.github.com/repos/willbarton/wagtail/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/willbarton/wagtail/downloads","issues_url":"https://api.github.com/repos/willbarton/wagtail/issues{/number}","pulls_url":"https://api.github.com/repos/willbarton/wagtail/pulls{/number}","milestones_url":"https://api.github.com/repos/willbarton/wagtail/milestones{/number}","notifications_url":"https://api.github.com/repos/willbarton/wagtail/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/willbarton/wagtail/labels{/name}","releases_url":"https://api.github.com/repos/willbarton/wagtail/releases{/id}","deployments_url":"https://api.github.com/repos/willbarton/wagtail/deployments","created_at":"2017-09-27T12:49:34Z","updated_at":"2017-09-27T12:49:40Z","pushed_at":"2017-12-06T19:36:16Z","git_url":"git://github.com/willbarton/wagtail.git","ssh_url":"git@github.com:willbarton/wagtail.git","clone_url":"https://github.com/willbarton/wagtail.git","svn_url":"https://github.com/willbarton/wagtail","homepage":"wagtail.io","size":59101,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"wagtail:master","ref":"master","sha":"8aa8ddcde986eee80e62ba6f185071e24669aeea","user":{"login":"wagtail","id":23708009,"avatar_url":"https://avatars3.githubusercontent.com/u/23708009?v=4","gravatar_id":"","url":"https://api.github.com/users/wagtail","html_url":"https://github.com/wagtail","followers_url":"https://api.github.com/users/wagtail/followers","following_url":"https://api.github.com/users/wagtail/following{/other_user}","gists_url":"https://api.github.com/users/wagtail/gists{/gist_id}","starred_url":"https://api.github.com/users/wagtail/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wagtail/subscriptions","organizations_url":"https://api.github.com/users/wagtail/orgs","repos_url":"https://api.github.com/users/wagtail/repos","events_url":"https://api.github.com/users/wagtail/events{/privacy}","received_events_url":"https://api.github.com/users/wagtail/received_events","type":"Organization","site_admin":false},"repo":{"id":16479108,"name":"wagtail","full_name":"wagtail/wagtail","owner":{"login":"wagtail","id":23708009,"avatar_url":"https://avatars3.githubusercontent.com/u/23708009?v=4","gravatar_id":"","url":"https://api.github.com/users/wagtail","html_url":"https://github.com/wagtail","followers_url":"https://api.github.com/users/wagtail/followers","following_url":"https://api.github.com/users/wagtail/following{/other_user}","gists_url":"https://api.github.com/users/wagtail/gists{/gist_id}","starred_url":"https://api.github.com/users/wagtail/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wagtail/subscriptions","organizations_url":"https://api.github.com/users/wagtail/orgs","repos_url":"https://api.github.com/users/wagtail/repos","events_url":"https://api.github.com/users/wagtail/events{/privacy}","received_events_url":"https://api.github.com/users/wagtail/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wagtail/wagtail","description":"A Django content management system focused on flexibility and user experience","fork":false,"url":"https://api.github.com/repos/wagtail/wagtail","forks_url":"https://api.github.com/repos/wagtail/wagtail/forks","keys_url":"https://api.github.com/repos/wagtail/wagtail/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wagtail/wagtail/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wagtail/wagtail/teams","hooks_url":"https://api.github.com/repos/wagtail/wagtail/hooks","issue_events_url":"https://api.github.com/repos/wagtail/wagtail/issues/events{/number}","events_url":"https://api.github.com/repos/wagtail/wagtail/events","assignees_url":"https://api.github.com/repos/wagtail/wagtail/assignees{/user}","branches_url":"https://api.github.com/repos/wagtail/wagtail/branches{/branch}","tags_url":"https://api.github.com/repos/wagtail/wagtail/tags","blobs_url":"https://api.github.com/repos/wagtail/wagtail/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wagtail/wagtail/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wagtail/wagtail/git/refs{/sha}","trees_url":"https://api.github.com/repos/wagtail/wagtail/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wagtail/wagtail/statuses/{sha}","languages_url":"https://api.github.com/repos/wagtail/wagtail/languages","stargazers_url":"https://api.github.com/repos/wagtail/wagtail/stargazers","contributors_url":"https://api.github.com/repos/wagtail/wagtail/contributors","subscribers_url":"https://api.github.com/repos/wagtail/wagtail/subscribers","subscription_url":"https://api.github.com/repos/wagtail/wagtail/subscription","commits_url":"https://api.github.com/repos/wagtail/wagtail/commits{/sha}","git_commits_url":"https://api.github.com/repos/wagtail/wagtail/git/commits{/sha}","comments_url":"https://api.github.com/repos/wagtail/wagtail/comments{/number}","issue_comment_url":"https://api.github.com/repos/wagtail/wagtail/issues/comments{/number}","contents_url":"https://api.github.com/repos/wagtail/wagtail/contents/{+path}","compare_url":"https://api.github.com/repos/wagtail/wagtail/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wagtail/wagtail/merges","archive_url":"https://api.github.com/repos/wagtail/wagtail/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wagtail/wagtail/downloads","issues_url":"https://api.github.com/repos/wagtail/wagtail/issues{/number}","pulls_url":"https://api.github.com/repos/wagtail/wagtail/pulls{/number}","milestones_url":"https://api.github.com/repos/wagtail/wagtail/milestones{/number}","notifications_url":"https://api.github.com/repos/wagtail/wagtail/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wagtail/wagtail/labels{/name}","releases_url":"https://api.github.com/repos/wagtail/wagtail/releases{/id}","deployments_url":"https://api.github.com/repos/wagtail/wagtail/deployments","created_at":"2014-02-03T12:41:59Z","updated_at":"2017-12-11T12:56:26Z","pushed_at":"2017-12-11T12:24:16Z","git_url":"git://github.com/wagtail/wagtail.git","ssh_url":"git@github.com:wagtail/wagtail.git","clone_url":"https://github.com/wagtail/wagtail.git","svn_url":"https://github.com/wagtail/wagtail","homepage":"wagtail.io","size":59196,"stargazers_count":4949,"watchers_count":4949,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1075,"mirror_url":null,"archived":false,"open_issues_count":583,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":1075,"open_issues":583,"watchers":4949,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wagtail/wagtail/pulls/4062"},"html":{"href":"https://github.com/wagtail/wagtail/pull/4062"},"issue":{"href":"https://api.github.com/repos/wagtail/wagtail/issues/4062"},"comments":{"href":"https://api.github.com/repos/wagtail/wagtail/issues/4062/comments"},"review_comments":{"href":"https://api.github.com/repos/wagtail/wagtail/pulls/4062/comments"},"review_comment":{"href":"https://api.github.com/repos/wagtail/wagtail/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wagtail/wagtail/pulls/4062/commits"},"statuses":{"href":"https://api.github.com/repos/wagtail/wagtail/statuses/7476bf79e760ebe403d0e286bce3d2dc250afa74"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"m1kola"}}