From a9d25f8719cdd6de23876623218cf4a22d080d65 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Mon, 9 Oct 2017 20:55:03 -0700 Subject: [PATCH] refactor: Simplify avatar_url. This function is now a thin wrapper around get_avatar_field. --- zerver/lib/avatar.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/zerver/lib/avatar.py b/zerver/lib/avatar.py index 68a52c583c..145c6016fc 100644 --- a/zerver/lib/avatar.py +++ b/zerver/lib/avatar.py @@ -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