Consistently use the gravatar 'mystery man' as fallback, regardless of whether gravatar is in use

The .svg had various design issues (didn't follow the square avatar design adopted in #2805, was aligned too low in the menu footer, and had a transparent background leading to grey-on-teal ugliness on the homepage).
pull/4503/head
Matt Westcott 2018-01-16 15:11:55 +00:00
rodzic ff6ca55b12
commit f81c7d619c
6 zmienionych plików z 4 dodań i 13 usunięć

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.6 KiB

Wyświetl plik

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="612px" height="792px" viewBox="0 0 612 792" enable-background="new 0 0 612 792" xml:space="preserve">
<path fill="#999999" d="M306,181.8c51,0,91.8,40.8,91.8,91.8S357,365.4,306,365.4s-91.8-40.8-91.8-91.8S255,181.8,306,181.8z"/>
<path fill="#999999" d="M306,616.575c-76.5,0-144.075-39.525-183.6-98.175c1.275-61.2,122.4-94.351,183.6-94.351
S488.325,457.2,489.6,518.4C450.075,577.05,382.5,616.575,306,616.575z"/>
</svg>

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 784 B

Wyświetl plik

@ -13,7 +13,7 @@
<header class="merged nice-padding">
<div class="row row-flush">
<div class="col1">
<div class="avatar"><img src="{% avatar_url user.email %}" alt="" /></div>
<div class="avatar"><img src="{% avatar_url user %}" alt="" /></div>
</div>
<div class="col9">
<h1>{% block branding_welcome %}{% blocktrans %}Welcome to the {{ site_name }} Wagtail CMS{% endblocktrans %}{% endblock %}</h1>

Wyświetl plik

@ -384,4 +384,4 @@ def avatar_url(context, user, size=50):
if hasattr(user, 'wagtail_userprofile'): # A user could not have profile yet, so this is necessary
return user.wagtail_userprofile.get_avatar_url(size=size)
return static('wagtailadmin/images/default-user-avatar.svg')
return static('wagtailadmin/images/default-user-avatar.png')

Wyświetl plik

@ -93,7 +93,7 @@ class UserProfile(models.Model):
@cached_property
def default_avatar(self):
return static('wagtailadmin/images/default-user-avatar.svg')
return static('wagtailadmin/images/default-user-avatar.png')
def get_avatar_url(self, size=50):
if self.avatar_choice == self.DEFAULT:

Wyświetl plik

@ -22,7 +22,7 @@ def user_can_delete_user(current_user, user_to_delete):
def get_gravatar_url(email, default=None, size=50):
params = {'s': str(size)}
params = {'s': str(size), 'd': 'mm'}
if default is not None:
params['default'] = default
gravatar_url = "https://www.gravatar.com/avatar/" + hashlib.md5(email.lower().encode('utf-8')).hexdigest() + "?"