Skip to content

Enhance Sponsor Avatar and Logo Handling with Fallbacks #908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

DiegoPisa2003
Copy link
Contributor

Overview

This PR improves the visual consistency and reliability of sponsor displays by implementing fallback systems for both avatars and logos. It addresses cases where external logo URLs become inaccessible and ensures all sponsors have proper visual representation.

What Changed

Enhanced Avatar System

  • UI Avatars Integration: Added generate_avatar_url method that creates dynamic avatars using ui-avatars.com API
  • Smart Avatar Fallback: Modified avatar_image_path to fallback to generated avatars when local images aren't available
  • Priority System: Local images > logo fallback > generated avatars

Robust Logo URL Handling

  • URL Accessibility Validation: Added logo_url_accessible? method that checks if external logo URLs are actually reachable
  • Network Resilience: Implements timeout handling (5s open, 10s read) and graceful error handling
  • Logo Fallback: When logo URLs are inaccessible, automatically falls back to avatar images instead of broken links

Future enhancement

I was thinking that for the logos_url that are inaccessible, we could mark them someway (maybe with a boolean) as inaccessible in a way that the next time we the app go through the logo_url_accessible? can see that boolean and does not have to do a HTTP request to see if it is accessible.

We would have to take into consideration if we implement that, that maybe the logo_url was momentarily inaccessible and then became accessible again, so periodically the app should try again to access the logo_url

Even if we do not merge this PR, I would like to set the record that we should somehow manage inaccessible logo_url in the backend, not only in the views

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant