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

Direct avatar rendering #13649

Merged
merged 23 commits into from
Dec 3, 2020
Merged

Direct avatar rendering #13649

merged 23 commits into from
Dec 3, 2020

Conversation

silverwind
Copy link
Member

@silverwind silverwind commented Nov 19, 2020

This adds new template helpers for avatar rendering which output image elements with direct links to avatars which makes them cacheable by the browsers.

This should be a major performance improvment for pages with many avatars.

@silverwind silverwind marked this pull request as draft November 19, 2020 20:41
@silverwind silverwind force-pushed the directavatars branch 2 times, most recently from 0d1a073 to db9f4c2 Compare November 23, 2020 21:01
@silverwind
Copy link
Member Author

Besides removal of dead code which I still plan to do, this should now be fully functional.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 23, 2020
@silverwind silverwind marked this pull request as ready for review November 23, 2020 21:37
@silverwind silverwind changed the title WIP: Direct avatar rendering Direct avatar rendering Nov 23, 2020
@lafriks lafriks added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Nov 23, 2020
@lafriks lafriks added this to the 1.14.0 milestone Nov 23, 2020
@silverwind
Copy link
Member Author

Gravatar avatars are not yet tested. Not sure yet if the changes from #10540 need further adjustments, the avatar code is highly convoluted unfortunately.

@silverwind
Copy link
Member Author

Gravatar is working as well. Initially the images were a bit blurry on my high-dpi screen and I fixed that by increasing the requested size by two times.

@silverwind
Copy link
Member Author

Org avatars are not working yet, they still emit those redirect URLs, not sure yet where to fix them.

templates/org/home.tmpl Outdated Show resolved Hide resolved
@silverwind silverwind marked this pull request as draft November 25, 2020 14:48
@silverwind silverwind force-pushed the directavatars branch 4 times, most recently from 94f2a58 to 9fa41a1 Compare November 29, 2020 19:03
@silverwind silverwind marked this pull request as ready for review November 29, 2020 19:03
@6543
Copy link
Member

6543 commented Nov 29, 2020

make fmt missing?

@silverwind
Copy link
Member Author

This is ready for review now. Turns out org avatars were already working and caching, I was just confused by their different URL scheme (they use /avatars/num instead of storage paths).

I don't think there is anything left to clean up from the old avatar code, bits and pieces are still in use in some places.

@6543

This comment has been minimized.

@silverwind
Copy link
Member Author

@6543 hmm I thought I fixed that earlier, will recheck.

@silverwind
Copy link
Member Author

I think you have to remove models dependency on base

Actually I got around by moving everything into models, thankfully

This is ready again, federated avatars are uncached and working just like before. Gravatar and self-hosted avatars are of course caching.

@silverwind silverwind marked this pull request as ready for review December 2, 2020 19:22
@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 Dec 2, 2020
Copy link
Member

@lunny lunny left a comment

Choose a reason for hiding this comment

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

@silverwind ha, I made a mistake.

@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 Dec 3, 2020
@silverwind
Copy link
Member Author

silverwind commented Dec 3, 2020

Planning to do one more small refactor later today because there is some duplication still left between base and models.

@6543 6543 added the pr/wip This PR is not ready for review label Dec 3, 2020
@6543
Copy link
Member

6543 commented Dec 3, 2020

@silverwind should we wait or start a follow up pull?

@silverwind
Copy link
Member Author

i'll do it in the next few hours, it should be rather trivial, please wait.

@silverwind
Copy link
Member Author

Dedupe done, ready now.

Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

realy nice refactor!

Copy link
Member

@mrsdizzie mrsdizzie left a comment

Choose a reason for hiding this comment

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

awesome ! 🖼

@6543 6543 removed the pr/wip This PR is not ready for review label Dec 3, 2020
@6543 6543 merged commit 9269a03 into go-gitea:master Dec 3, 2020
@silverwind silverwind deleted the directavatars branch December 3, 2020 19:00
@go-gitea go-gitea locked and limited conversation to collaborators Jan 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants