diff --git a/templates/admin/release_report_detail.html b/templates/admin/release_report_detail.html index 92a44efc1..379d60965 100644 --- a/templates/admin/release_report_detail.html +++ b/templates/admin/release_report_detail.html @@ -187,7 +187,7 @@

From the Fiscal Sponsorship Committee

{% for user in committee_members|dictsort:"display_name" %}
- {% avatar user=user is_link=False image_size="w-32 h-32" icon_size="text-8xl" %} + {% avatar user=user is_link=False image_size="w-32 h-32" icon_size="text-8xl" use_user_hq_image=True %}
{{user.display_name}}
{% endfor %} diff --git a/users/models.py b/users/models.py index 99ff6e595..fe1d18386 100644 --- a/users/models.py +++ b/users/models.py @@ -292,6 +292,12 @@ def get_thumbnail_url(self): with suppress(AttributeError, MissingSource): return getattr(self.image_thumbnail, "url", None) + def get_hq_image_url(self): + # convenience method for templates + if self.hq_image and self.hq_image_render: + with suppress(AttributeError, MissingSource): + return getattr(self.hq_image_render, "url", None) + @property def github_profile_url(self): if not self.github_username: diff --git a/users/templatetags/avatar_tags.py b/users/templatetags/avatar_tags.py index a5075a49d..867dcd194 100644 --- a/users/templatetags/avatar_tags.py +++ b/users/templatetags/avatar_tags.py @@ -44,6 +44,7 @@ def avatar( icon_size=None, contributor_label=None, avatar_type=None, + use_user_hq_image=False, ): def get_commit_author_attribute(commitauthor, attribute): if isinstance(commitauthor, dict): @@ -64,22 +65,27 @@ def get_commit_author_attribute(commitauthor, attribute): } if user and commitauthor: - image_url = user.get_thumbnail_url() or get_commit_author_attribute( + std_image = user.get_thumbnail_url() or get_commit_author_attribute( commitauthor, "avatar_url" ) + hq_image = user.get_hq_image_url() + use_hq_image = use_user_hq_image and hq_image href = user.github_profile_url or get_commit_author_attribute( commitauthor, "github_profile_url" ) return base_avatar( commitauthor.display_name, - image_url, + hq_image if use_hq_image else std_image, href, **kwargs, ) elif user: + std_image = user.get_thumbnail_url() + hq_image = user.get_hq_image_url() + use_hq_image = use_user_hq_image and hq_image return base_avatar( user.display_name, - user.get_thumbnail_url(), + hq_image if use_hq_image else std_image, user.github_profile_url, **kwargs, )