mirror of
1
Fork 0
forgejo/services
wxiaoguang f0ba87fda8
Avatar refactor, move avatar code from `models` to `models.avatars`, remove duplicated code (#17123)
Why this refactor

The goal is to move most files from `models` package to `models.xxx` package. Many models depend on avatar model, so just move this first.

And the existing logic is not clear, there are too many function like `AvatarLink`, `RelAvatarLink`, `SizedRelAvatarLink`, `SizedAvatarLink`, `MakeFinalAvatarURL`, `HashedAvatarLink`, etc. This refactor make everything clear:

* user.AvatarLink()
* user.AvatarLinkWithSize(size)
* avatars.GenerateEmailAvatarFastLink(email, size)
* avatars.GenerateEmailAvatarFinalLink(email, size)

And many duplicated code are deleted in route handler, the handler and the model share the same avatar logic now.
2021-10-06 01:25:46 +02:00
..
agit Return correct error response for agit force-push (#16989) 2021-09-08 22:20:55 +02:00
archiver Fix bundle creation (#17079) 2021-09-26 00:29:25 +03:00
attachment DBContext is just a Context (#17100) 2021-09-23 23:45:36 +08:00
auth Avatar refactor, move avatar code from `models` to `models.avatars`, remove duplicated code (#17123) 2021-10-06 01:25:46 +02:00
comments DBContext is just a Context (#17100) 2021-09-23 23:45:36 +08:00
externalaccount Move login related structs and functions to models/login (#17093) 2021-09-24 19:32:56 +08:00
forms Kanban colored boards (#16647) 2021-09-29 22:53:12 +02:00
gitdiff Support direct comparison (git diff a..b) as well merge comparison (a...b) (#16635) 2021-09-27 13:19:34 +01:00
issue DBContext is just a Context (#17100) 2021-09-23 23:45:36 +08:00
lfs Test if LFS object is accessible (#16865) 2021-08-31 14:35:08 +01:00
mailer Always set a unique Message-ID header. (#17206) 2021-10-01 11:24:43 -04:00
mirror DBContext is just a Context (#17100) 2021-09-23 23:45:36 +08:00
pull Don't return binary file changes in raw PR diffs by default (#17158) 2021-09-27 17:09:49 -04:00
release DBContext is just a Context (#17100) 2021-09-23 23:45:36 +08:00
repository DBContext is just a Context (#17100) 2021-09-23 23:45:36 +08:00
webhook Add specific event type to header (#17222) 2021-10-05 12:12:17 -05:00
wiki refactor: move from io/ioutil to io and os package (#17109) 2021-09-22 13:38:34 +08:00