aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2021-10-06 07:25:46 +0800
committerGitHub <noreply@github.com>2021-10-06 01:25:46 +0200
commitf0ba87fda88c7bb601eee17f3e3a72bea8a71521 (patch)
treecb5caf3a22fceaec8d2d421bec0cb094ecdb9c53 /templates
parent48c2578bd8ce4ddd90bf926bd40388f57c90fe14 (diff)
downloadgitea-f0ba87fda88c7bb601eee17f3e3a72bea8a71521.tar.gz
gitea-f0ba87fda88c7bb601eee17f3e3a72bea8a71521.zip
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.
Diffstat (limited to 'templates')
-rw-r--r--templates/base/head.tmpl4
-rw-r--r--templates/repo/issue/view_content/comments.tmpl2
2 files changed, 3 insertions, 3 deletions
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index 328661eb9d..15f2826abf 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -48,11 +48,11 @@
tributeValues: Array.from(new Map([
{{ range .Participants }}
['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}',
- name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.RelAvatarLink}}'}],
+ name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink}}'}],
{{ end }}
{{ range .Assignees }}
['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}',
- name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.RelAvatarLink}}'}],
+ name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink}}'}],
{{ end }}
{{ range .MentionableTeams }}
['{{$.MentionableTeamsOrg}}/{{.Name}}', {key: '{{$.MentionableTeamsOrg}}/{{.Name}}', value: '{{$.MentionableTeamsOrg}}/{{.Name}}',
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl
index dabba7bc74..c7d7574231 100644
--- a/templates/repo/issue/view_content/comments.tmpl
+++ b/templates/repo/issue/view_content/comments.tmpl
@@ -746,7 +746,7 @@
<div class="timeline-item-group">
<div class="timeline-item event" id="{{.HashTag}}">
<a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
- <img src="{{.Poster.RelAvatarLink}}">
+ <img src="{{.Poster.AvatarLink}}">
</a>
<span class="badge grey">{{svg "octicon-x" 16}}</span>
<span class="text grey">