From 47d3811aa585e52889f5ae3ded177b1d61ee20a8 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Thu, 24 Aug 2023 00:02:02 -0500 Subject: [PATCH] Fix another bug for user search --- judge/jinja2/gravatar.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/judge/jinja2/gravatar.py b/judge/jinja2/gravatar.py index c11e683..cffa413 100644 --- a/judge/jinja2/gravatar.py +++ b/judge/jinja2/gravatar.py @@ -14,9 +14,10 @@ def gravatar(profile, size=80, default=None, profile_image=None, email=None): return profile_image if profile and profile.profile_image: return profile.profile_image.url - if default is None and profile: - default = profile.mute - email = email or profile.user.email + if profile: + email = email or profile.user.email + if default is None: + default = profile.mute gravatar_url = ( "//www.gravatar.com/avatar/" + hashlib.md5(utf8bytes(email.strip().lower())).hexdigest()