Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/admin/release_report_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ <h2 class="mt-0">From the Fiscal Sponsorship Committee</h2>
<div class="committee_members flex flex-wrap mt-2 text-sm text-center absolute" style="">
{% for user in committee_members|dictsort:"display_name" %}
<figure class="w-32 m-2">
{% 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 %}
<figcaption class="p-1">{{user.display_name}}</figcaption>
</figure>
{% endfor %}
Expand Down
6 changes: 6 additions & 0 deletions users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 9 additions & 3 deletions users/templatetags/avatar_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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,
)
Expand Down