refactor: Simplify avatar_url.

This function is now a thin wrapper around get_avatar_field.
This commit is contained in:
Steve Howell
2017-10-09 20:55:03 -07:00
committed by Tim Abbott
parent b0e844c676
commit a9d25f8719

View File

@@ -10,16 +10,18 @@ from zerver.lib.upload import upload_backend, MEDIUM_AVATAR_SIZE
from zerver.models import UserProfile
from six.moves import urllib
def avatar_url(user_profile, medium=False):
# type: (UserProfile, bool) -> Text
return avatar_url_from_dict(
dict(
avatar_source=user_profile.avatar_source,
avatar_version=user_profile.avatar_version,
email=user_profile.email,
id=user_profile.id,
realm_id=user_profile.realm_id),
medium=medium)
def avatar_url(user_profile, medium=False, client_gravatar=False):
# type: (UserProfile, bool, bool) -> Text
return get_avatar_field(
user_id=user_profile.id,
realm_id=user_profile.realm_id,
email=user_profile.email,
avatar_source=user_profile.avatar_source,
avatar_version=user_profile.avatar_version,
medium=medium,
client_gravatar=client_gravatar,
)
def avatar_url_from_dict(userdict, medium=False):
# type: (Dict[str, Any], bool) -> Text