server/users: change avatars to PNG

This commit is contained in:
rr- 2016-05-08 17:29:23 +02:00
parent da1386c7d2
commit 906eddc61f
3 changed files with 4 additions and 4 deletions

View file

@ -30,7 +30,7 @@ def serialize_user(user, authenticated_user, force_show_email=False):
util.get_md5((user.email or user.name).lower()),
config.config['thumbnails']['avatar_width'])
else:
ret['avatarUrl'] = '%s/avatars/%s.jpg' % (
ret['avatarUrl'] = '%s/avatars/%s.png' % (
config.config['data_url'].rstrip('/'), user.name.lower())
if authenticated_user.user_id != user.user_id \
@ -146,7 +146,7 @@ def update_user_avatar(user, avatar_style, avatar_content):
image.resize_fill(
int(config.config['thumbnails']['avatar_width']),
int(config.config['thumbnails']['avatar_height']))
files.save('avatars/' + user.name.lower() + '.jpg', image.to_jpeg())
files.save('avatars/' + user.name.lower() + '.png', image.to_png())
else:
raise InvalidAvatarError(
'Avatar style %r is invalid. Valid avatar styles: %r.' % (

View file

@ -226,4 +226,4 @@ def test_uploading_avatar(test_ctx, tmpdir):
user = users.get_user_by_name('chewie')
assert user.avatar_style == user.AVATAR_MANUAL
assert response['user']['avatarUrl'] == \
'http://example.com/data/avatars/chewie.jpg'
'http://example.com/data/avatars/chewie.png'

View file

@ -202,4 +202,4 @@ def test_uploading_avatar(test_ctx, tmpdir):
user = users.get_user_by_name('u1')
assert user.avatar_style == user.AVATAR_MANUAL
assert response['user']['avatarUrl'] == \
'http://example.com/data/avatars/u1.jpg'
'http://example.com/data/avatars/u1.png'