mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
refactor: Simplify avatar_url.
This function is now a thin wrapper around get_avatar_field.
This commit is contained in:
@@ -10,16 +10,18 @@ from zerver.lib.upload import upload_backend, MEDIUM_AVATAR_SIZE
|
|||||||
from zerver.models import UserProfile
|
from zerver.models import UserProfile
|
||||||
from six.moves import urllib
|
from six.moves import urllib
|
||||||
|
|
||||||
def avatar_url(user_profile, medium=False):
|
def avatar_url(user_profile, medium=False, client_gravatar=False):
|
||||||
# type: (UserProfile, bool) -> Text
|
# type: (UserProfile, bool, bool) -> Text
|
||||||
return avatar_url_from_dict(
|
|
||||||
dict(
|
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_source=user_profile.avatar_source,
|
||||||
avatar_version=user_profile.avatar_version,
|
avatar_version=user_profile.avatar_version,
|
||||||
email=user_profile.email,
|
medium=medium,
|
||||||
id=user_profile.id,
|
client_gravatar=client_gravatar,
|
||||||
realm_id=user_profile.realm_id),
|
)
|
||||||
medium=medium)
|
|
||||||
|
|
||||||
def avatar_url_from_dict(userdict, medium=False):
|
def avatar_url_from_dict(userdict, medium=False):
|
||||||
# type: (Dict[str, Any], bool) -> Text
|
# type: (Dict[str, Any], bool) -> Text
|
||||||
|
|||||||
Reference in New Issue
Block a user