Only check for gravatar if internet

This commit is contained in:
amcmanu3 2022-09-09 15:00:08 -04:00
parent 1b2fef06fb
commit 375df0c27d
3 changed files with 15 additions and 3 deletions

View File

@ -338,7 +338,11 @@ class PanelHandler(BaseHandler):
rating = "g"
# Get grvatar hash for profile pictures
if exec_user["email"] != "default@example.com" or "":
if (
self.helper.check_internet()
and exec_user["email"] != "default@example.com"
and exec_user["email"] == ""
):
gravatar = libgravatar.Gravatar(
libgravatar.sanitize_email(exec_user["email"])
)

View File

@ -28,7 +28,11 @@ class ApiUsersUserPfpHandler(BaseApiHandler):
rating = "g"
# Get grvatar hash for profile pictures
if user["email"] != "default@example.com" or "":
if (
self.helper.check_internet()
and user["email"] != "default@example.com"
and user["email"] == ""
):
gravatar = libgravatar.Gravatar(libgravatar.sanitize_email(user["email"]))
url = gravatar.get_image(
size=80,

View File

@ -138,7 +138,11 @@ class ServerHandler(BaseHandler):
else:
rating = "g"
if exec_user["email"] != "default@example.com" or "":
if (
self.helper.check_internet()
and exec_user["email"] != "default@example.com"
and exec_user["email"] == ""
):
gravatar = libgravatar.Gravatar(
libgravatar.sanitize_email(exec_user["email"])
)