Skip to content

feat: Added FXA profile image#4204

Open
wassafshahzad wants to merge 2 commits into
mozilla:mainfrom
wassafshahzad:wassaf/4017-mozilla-profile-image
Open

feat: Added FXA profile image#4204
wassafshahzad wants to merge 2 commits into
mozilla:mainfrom
wassafshahzad:wassaf/4017-mozilla-profile-image

Conversation

@wassafshahzad

Copy link
Copy Markdown
Contributor

Description

Added FXA avatar scope and the avatar will be loaded on runtime using the user_gravatar_url if available.

Linked Issue

Closes #4017

Screenshot

Profle Image

Caveats

There several caveats with this implementation

  • Users using the Gravatar Image with FXA accounts will have there avatars replaced with FXA one since we prioritize FXA ones. The reason is because we are sending the Gravatar image url back to the template. To prioritize it we will first have to send a http request to the url and if it fails default to FXA.
  • The class rounded on img tag does make the FXA image look a bit boxy, see screenshot.

@wassafshahzad wassafshahzad marked this pull request as ready for review June 9, 2026 09:20

@mathjazz mathjazz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. I haven't tested yet, but found a potential improvement for code readability.

Comment thread pontoon/base/models/user.py Outdated
@@ -23,6 +23,12 @@ def user_profile_url(self):


def user_gravatar_url(self, size):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gravatar_url() can now return a non-Gravatar URL, which makes the name misleading. Could we either rename the helper or add a small wrapper so template code can use the more accurate name?

Suggested change
def user_gravatar_url(self, size):
def user_avatar_url(self, size):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can rename it. The only reason I didnt do it before is because we add user_gravater_url as a property to the usermodel name gravatar_url and also alias it in the user_gravatar_url_small. Should I just change this function name and its refrences or also the property ? I suggest just the function name

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The properties as well, please.

@wassafshahzad

Copy link
Copy Markdown
Contributor Author

@mathjazz A lot of the code for these changes has moved to a user_util.py and thus this PR has a lot of conflicts. I you give the go ahead I can close this PR and make a new one from main. I can rebase and try to resolve the merge conflicts but I would still have to duplicate my changes and by closing this PR an making a new one I can ensure no bug goes through

@mathjazz

mathjazz commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

@mathjazz A lot of the code for these changes has moved to a user_util.py and thus this PR has a lot of conflicts. I you give the go ahead I can close this PR and make a new one from main. I can rebase and try to resolve the merge conflicts but I would still have to duplicate my changes and by closing this PR an making a new one I can ensure no bug goes through

I'm sorry about this. :/ We were just working on refactoring the User model. You can rebase here or open a new PR, either works. Thanks for understanding!

@wassafshahzad

Copy link
Copy Markdown
Contributor Author

@mathjazz A lot of the code for these changes has moved to a user_util.py and thus this PR has a lot of conflicts. I you give the go ahead I can close this PR and make a new one from main. I can rebase and try to resolve the merge conflicts but I would still have to duplicate my changes and by closing this PR an making a new one I can ensure no bug goes through

I'm sorry about this. :/ We were just working on refactoring the User model. You can rebase here or open a new PR, either works. Thanks for understanding!

No problem, I will open a new PR to make sure nor bugs creep in

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.

Add Mozilla Account profile avatar as an alternative to Gravatar

2 participants