Skip to content
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

User icons don't load #301

Closed
kelson42 opened this issue Apr 9, 2024 · 8 comments · Fixed by #316
Closed

User icons don't load #301

kelson42 opened this issue Apr 9, 2024 · 8 comments · Fixed by #316
Assignees
Labels
Milestone

Comments

@kelson42
Copy link
Contributor

kelson42 commented Apr 9, 2024

Screenshot_20240409-095504.png

User icons don't load properly in user lists... but once the force reloaded, then they load properly.

I believe this is not the only place with this bug around user icons.

@kelson42 kelson42 changed the title Screenshot (9 Apr 2024 09:55:04) Iser icon don't load Apr 9, 2024
@kelson42 kelson42 changed the title Iser icon don't load User icon don't load Apr 9, 2024
@kelson42 kelson42 added the bug label Apr 9, 2024
@kelson42 kelson42 modified the milestones: 2.1.0, 2.2.0 Apr 9, 2024
@benoit74
Copy link
Collaborator

benoit74 commented Apr 9, 2024

I confirm bug is also present in questions.

For instance you can see it on https://library.kiwix.org/viewer#askubuntu.com_en_all_2024-03/questions/17823/how-to-list-all-installed-packages and https://askubuntu.com/questions/17823/how-to-list-all-installed-packages where anonymous2 and Ivan have a custom profile image in the online version but not inside the ZIM.

Looks like for each user image we get a 404 error on a webp resource (e.g. https://library.kiwix.org/content/askubuntu.com_en_all_2024-03/users/profiles/527350.webp)

When we force reload the webpage, we still have the 404 but the image is finally replaced by an inline SVG.

The inline SVG looks like a randomly generated image which is served when the user has no profile image

Looks like some JS code is not ran under all conditions.

This looks like a promising good first issue. I recommend to test it on the beer meta which is used in our automated tests (see https://github.com/openzim/sotoki/blob/3d8845d079d11ba41343a8ca1f63f779261e754b/.github/workflows/ci.yml#L15C57-L15C102), is way smaller than askubuntu and most probably also has the bug.

@kelson42 kelson42 changed the title User icon don't load User icons don't load Apr 9, 2024
@rgaudin
Copy link
Member

rgaudin commented Apr 9, 2024

Haven't looked at it but might be linked to webp polyfill since that's async

@kelson42 kelson42 pinned this issue Apr 13, 2024
@benoit74
Copy link
Collaborator

benoit74 commented May 6, 2024

Originally, profile image was sourced from "ProfileImageUrl".

This column seems to now systematically be blank in Users table of SO: https://data.stackexchange.com/stackoverflow/query/1840413

See also https://meta.stackexchange.com/questions/247032/missing-profileimageurl-for-many-profiles-in-stackoverflow-data-dump and https://meta.stackexchange.com/questions/390985/why-are-the-profileimageurl-in-the-data-dump-of-almost-all-stack-exchange-websit

EmailHash were previously available but has been removed as well even before profileImageUrl: https://meta.stackexchange.com/questions/221027/where-did-emailhash-go

I think there is nothing we can do unfortunately ...

@benoit74
Copy link
Collaborator

benoit74 commented May 6, 2024

If fact, there is something to do to not have broken image. We cannot have the proper gravatar anymore, but users should not be presented with broken images. The only thing we can do it stop relying on the fallback / ensure fallback works immediately.

@benoit74
Copy link
Collaborator

benoit74 commented May 6, 2024

Problem seems to be that jidenticon.min.js behavior is quite unstable.

I created a very simple HTML file like this:

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta content="utf-8" http-equiv="encoding">
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>TED Talks</title>
    <link id="favicon" rel="shortcut icon" href="favicon.png" type="image/png">
    <script src="./sotoki/jdenticon.min.js"></script>
    <script src="./sotoki/webp-hero.polyfill.js"></script>
</head>

<body>
    <svg width="80" height="80" data-jdenticon-value="Andrew Cheong"></svg>

</body>

</html>

Simply serving the file from python -m http.server allows to see the bug.

The bug is very random:

  • sometimes it works, sometimes it doesn't
  • inverting the order of JS scripts helps to have the image displayed (i.e. it is better when jidenticon.min.js is last) but there is still few random issues (which is not acceptable)
  • replacing the second (webp-hero.polyfill.js) by a file which does not exists at all causes a mostly systematic bug

🤯🤯🤯🤯

@benoit74
Copy link
Collaborator

benoit74 commented May 6, 2024

Maybe we should consider replacing jdenticon with something else: https://github.com/topics/identicons

@benoit74
Copy link
Collaborator

benoit74 commented May 6, 2024

I opened dmester/jdenticon#54

@benoit74 benoit74 self-assigned this May 6, 2024
@kelson42
Copy link
Contributor Author

Bug fixed upstream, we should upgrade to https://github.com/dmester/jdenticon/releases/tag/3.3.0

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

Successfully merging a pull request may close this issue.

3 participants