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

Send size to /avatars if requested #15459

Merged
merged 4 commits into from
Apr 16, 2021

Conversation

zeripath
Copy link
Contributor

If an avatar is requested in a particular size ensure that /avatars also gets the
size request

Fix #15453

Signed-off-by: Andrew Thornton [email protected]

If an avatar is requested in a particular size ensure that /avatars also gets the
size request

Fix go-gitea#15453

Signed-off-by: Andrew Thornton <[email protected]>
@@ -82,14 +82,19 @@ func (u *User) RealSizedAvatarLink(size int) string {
if u.Avatar == "" {
return DefaultAvatarLink()
}
if size > 0 {
return setting.AppSubURL + "/avatars/" + u.Avatar + "?size=" + strconv.Itoa(size)
Copy link
Member

Choose a reason for hiding this comment

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

What does the size parameter do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nothing right now - but we should probably keep sending it for future options

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 14, 2021
@silverwind
Copy link
Member

silverwind commented Apr 14, 2021

I think we should request higher resolution from gravatar, like requested image size times 2 like it is done for other images as well. Or maybe just hardcode to 580 which is enough for all UI use cases.

https://secure.gravatar.com/avatar/f403e3d7796b4258b34481722014f370?d=identicon

vs

https://secure.gravatar.com/avatar/f403e3d7796b4258b34481722014f370?d=identicon&s=580

Or am I misunderstanding and this PR already does this?

@zeripath
Copy link
Contributor Author

This PR means that if you request a size that size will get passed down to gravatar.

Copy link
Member

@silverwind silverwind left a comment

Choose a reason for hiding this comment

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

Can confirm this fixes the issue with such a configuration:

[picture]
DISABLE_GRAVATAR = false
GRAVATAR_SOURCE = gravatar
ENABLE_FEDERATED_AVATAR = true

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 15, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 16, 2021
@6543
Copy link
Member

6543 commented Apr 16, 2021

🚀

@6543 6543 merged commit 324cff6 into go-gitea:master Apr 16, 2021
@zeripath zeripath deleted the fix-15453-avatar-sizes branch April 17, 2021 09:30
zeripath added a commit to zeripath/gitea that referenced this pull request Apr 17, 2021
Backport go-gitea#15459

If an avatar is requested in a particular size ensure that /avatars also gets the size request

Fix go-gitea#15453

Signed-off-by: Andrew Thornton <[email protected]>
@zeripath zeripath added the backport/done All backports for this PR have been created label Apr 17, 2021
zeripath added a commit that referenced this pull request Apr 17, 2021
Backport #15459

If an avatar is requested in a particular size ensure that /avatars also gets the size request

Fix #15453

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: 6543 <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Jun 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gravatar resolution mismatch
7 participants