summaryrefslogtreecommitdiffstats
path: root/templates/repo
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-02-15 21:37:34 +0800
committerGitHub <noreply@github.com>2023-02-15 21:37:34 +0800
commitbd820aa9c52da4568b460a0b8604287f8ed8df26 (patch)
tree15e59e1d4f705b1c5adbd418ed711dfd602a1b25 /templates/repo
parent03638f9725de3cda5207384098b38462f56d442e (diff)
downloadgitea-bd820aa9c52da4568b460a0b8604287f8ed8df26.tar.gz
gitea-bd820aa9c52da4568b460a0b8604287f8ed8df26.zip
Add context cache as a request level cache (#22294)
To avoid duplicated load of the same data in an HTTP request, we can set a context cache to do that. i.e. Some pages may load a user from a database with the same id in different areas on the same page. But the code is hidden in two different deep logic. How should we share the user? As a result of this PR, now if both entry functions accept `context.Context` as the first parameter and we just need to refactor `GetUserByID` to reuse the user from the context cache. Then it will not be loaded twice on an HTTP request. But of course, sometimes we would like to reload an object from the database, that's why `RemoveContextData` is also exposed. The core context cache is here. It defines a new context ```go type cacheContext struct { ctx context.Context data map[any]map[any]any lock sync.RWMutex } var cacheContextKey = struct{}{} func WithCacheContext(ctx context.Context) context.Context { return context.WithValue(ctx, cacheContextKey, &cacheContext{ ctx: ctx, data: make(map[any]map[any]any), }) } ``` Then you can use the below 4 methods to read/write/del the data within the same context. ```go func GetContextData(ctx context.Context, tp, key any) any func SetContextData(ctx context.Context, tp, key, value any) func RemoveContextData(ctx context.Context, tp, key any) func GetWithContextCache[T any](ctx context.Context, cacheGroupKey string, cacheTargetID any, f func() (T, error)) (T, error) ``` Then let's take a look at how `system.GetString` implement it. ```go func GetSetting(ctx context.Context, key string) (string, error) { return cache.GetWithContextCache(ctx, contextCacheKey, key, func() (string, error) { return cache.GetString(genSettingCacheKey(key), func() (string, error) { res, err := GetSettingNoCache(ctx, key) if err != nil { return "", err } return res.SettingValue, nil }) }) } ``` First, it will check if context data include the setting object with the key. If not, it will query from the global cache which may be memory or a Redis cache. If not, it will get the object from the database. In the end, if the object gets from the global cache or database, it will be set into the context cache. An object stored in the context cache will only be destroyed after the context disappeared.
Diffstat (limited to 'templates/repo')
-rw-r--r--templates/repo/commit_page.tmpl12
-rw-r--r--templates/repo/commits_list.tmpl4
-rw-r--r--templates/repo/commits_list_small.tmpl4
-rw-r--r--templates/repo/create.tmpl6
-rw-r--r--templates/repo/diff/comments.tmpl2
-rw-r--r--templates/repo/editor/commit_form.tmpl2
-rw-r--r--templates/repo/forks.tmpl2
-rw-r--r--templates/repo/graph/commits.tmpl4
-rw-r--r--templates/repo/issue/list.tmpl6
-rw-r--r--templates/repo/issue/milestone_issues.tmpl6
-rw-r--r--templates/repo/issue/new_form.tmpl6
-rw-r--r--templates/repo/issue/view_content.tmpl8
-rw-r--r--templates/repo/issue/view_content/comments.tmpl64
-rw-r--r--templates/repo/issue/view_content/pull.tmpl2
-rw-r--r--templates/repo/issue/view_content/sidebar.tmpl12
-rw-r--r--templates/repo/migrate/codebase.tmpl6
-rw-r--r--templates/repo/migrate/git.tmpl6
-rw-r--r--templates/repo/migrate/gitbucket.tmpl6
-rw-r--r--templates/repo/migrate/gitea.tmpl6
-rw-r--r--templates/repo/migrate/github.tmpl6
-rw-r--r--templates/repo/migrate/gitlab.tmpl6
-rw-r--r--templates/repo/migrate/gogs.tmpl6
-rw-r--r--templates/repo/migrate/onedev.tmpl6
-rw-r--r--templates/repo/projects/view.tmpl2
-rw-r--r--templates/repo/pulls/fork.tmpl6
-rw-r--r--templates/repo/release/list.tmpl4
-rw-r--r--templates/repo/settings/collaboration.tmpl2
-rw-r--r--templates/repo/settings/lfs_locks.tmpl2
-rw-r--r--templates/repo/settings/protected_branch.tmpl6
-rw-r--r--templates/repo/settings/tags.tmpl4
-rw-r--r--templates/repo/shabox_badge.tmpl4
-rw-r--r--templates/repo/user_cards.tmpl2
-rw-r--r--templates/repo/view_list.tmpl4
33 files changed, 112 insertions, 112 deletions
diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl
index 632212c8c5..a0cd12674a 100644
--- a/templates/repo/commit_page.tmpl
+++ b/templates/repo/commit_page.tmpl
@@ -146,24 +146,24 @@
<div class="ui attached segment gt-df gt-ac gt-sb gt-py-2 commit-header-row gt-fw {{$class}}">
<div class="gt-df gt-ac author">
{{if .Author}}
- {{avatar .Author 28 "gt-mr-3"}}
+ {{avatar $.Context .Author 28 "gt-mr-3"}}
{{if .Author.FullName}}
<a href="{{.Author.HomeLink}}"><strong>{{.Author.FullName}}</strong></a>
{{else}}
<a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a>
{{end}}
{{else}}
- {{avatarByEmail .Commit.Author.Email .Commit.Author.Email 28 "gt-mr-3"}}
+ {{avatarByEmail $.Context .Commit.Author.Email .Commit.Author.Email 28 "gt-mr-3"}}
<strong>{{.Commit.Author.Name}}</strong>
{{end}}
<span class="text grey gt-ml-3" id="authored-time">{{TimeSince .Commit.Author.When $.locale}}</span>
{{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}}
<span class="text grey gt-mx-3">{{.locale.Tr "repo.diff.committed_by"}}</span>
{{if ne .Verification.CommittingUser.ID 0}}
- {{avatar .Verification.CommittingUser 28 "gt-mx-3"}}
+ {{avatar $.Context .Verification.CommittingUser 28 "gt-mx-3"}}
<a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}</strong></a>
{{else}}
- {{avatarByEmail .Commit.Committer.Email .Commit.Committer.Name 28 "gt-mr-3"}}
+ {{avatarByEmail $.Context .Commit.Committer.Email .Commit.Committer.Name 28 "gt-mr-3"}}
<strong>{{.Commit.Committer.Name}}</strong>
{{end}}
{{end}}
@@ -200,12 +200,12 @@
{{else}}
<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}:</span>
{{end}}
- {{avatar .Verification.SigningUser 28 "gt-mr-3"}}
+ {{avatar $.Context .Verification.SigningUser 28 "gt-mr-3"}}
<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.GetDisplayName}}</strong></a>
{{else}}
<span title="{{.locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16 "gt-mr-3"}}</span>
<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.signed_by"}}:</span>
- {{avatarByEmail .Verification.SigningEmail "" 28}}
+ {{avatarByEmail $.Context .Verification.SigningEmail "" 28}}
<strong>{{.Verification.SigningUser.GetDisplayName}}</strong>
{{end}}
{{else}}
diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl
index bef24e43e3..4341a428b7 100644
--- a/templates/repo/commits_list.tmpl
+++ b/templates/repo/commits_list.tmpl
@@ -18,9 +18,9 @@
{{if .User.FullName}}
{{$userName = .User.FullName}}
{{end}}
- {{avatar .User 28 "gt-mr-2"}}<a href="{{.User.HomeLink}}">{{$userName}}</a>
+ {{avatar $.Context .User 28 "gt-mr-2"}}<a href="{{.User.HomeLink}}">{{$userName}}</a>
{{else}}
- {{avatarByEmail .Author.Email .Author.Name 28 "gt-mr-2"}}
+ {{avatarByEmail $.Context .Author.Email .Author.Name 28 "gt-mr-2"}}
{{$userName}}
{{end}}
</td>
diff --git a/templates/repo/commits_list_small.tmpl b/templates/repo/commits_list_small.tmpl
index 4a4e7f12f9..49457b47fc 100644
--- a/templates/repo/commits_list_small.tmpl
+++ b/templates/repo/commits_list_small.tmpl
@@ -7,10 +7,10 @@
<span class="badge badge-commit">{{svg "octicon-git-commit"}}</span>
{{if .User}}
<a href="{{.User.HomeLink}}">
- {{avatar .User}}
+ {{avatar $.root.Context .User}}
</a>
{{else}}
- {{avatarByEmail .Author.Email .Author.Name}}
+ {{avatarByEmail $.root.Context .Author.Email .Author.Name}}
{{end}}
<span class="ui float right shabox">
diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl
index 94f6f95173..1f8e1f59df 100644
--- a/templates/repo/create.tmpl
+++ b/templates/repo/create.tmpl
@@ -21,18 +21,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
- {{avatar .ContextUser 28 "mini"}}
+ {{avatar $.Context .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}">
- {{avatar .SignedUser 28 "mini"}}
+ {{avatar $.Context .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
- {{avatar . 28 "mini"}}
+ {{avatar $.Context . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}
diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl
index c5cdf75085..ebed33bf21 100644
--- a/templates/repo/diff/comments.tmpl
+++ b/templates/repo/diff/comments.tmpl
@@ -5,7 +5,7 @@
{{if .OriginalAuthor}}
<span class="avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
{{else}}
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
{{end}}
<div class="content comment-container">
<div class="ui top attached header comment-header gt-df gt-ac gt-sb">
diff --git a/templates/repo/editor/commit_form.tmpl b/templates/repo/editor/commit_form.tmpl
index f7740fa615..7fac7f13bc 100644
--- a/templates/repo/editor/commit_form.tmpl
+++ b/templates/repo/editor/commit_form.tmpl
@@ -1,5 +1,5 @@
<div class="commit-form-wrapper">
- {{avatar .SignedUser 48 "commit-avatar"}}
+ {{avatar $.Context .SignedUser 48 "commit-avatar"}}
<div class="commit-form">
<h3>{{- if .CanCommitToBranch.WillSign}}
<span title="{{.locale.Tr "repo.signing.will_sign" .CanCommitToBranch.SigningKey}}">{{svg "octicon-lock" 24}}</span>
diff --git a/templates/repo/forks.tmpl b/templates/repo/forks.tmpl
index b328dc0c19..b05ebcc638 100644
--- a/templates/repo/forks.tmpl
+++ b/templates/repo/forks.tmpl
@@ -8,7 +8,7 @@
<div class="ui list">
{{range .Forks}}
<div class="item">
- {{avatar .Owner}}
+ {{avatar $.Context .Owner}}
<div class="link">
<a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>
/
diff --git a/templates/repo/graph/commits.tmpl b/templates/repo/graph/commits.tmpl
index 485227e9bf..0c1e777c34 100644
--- a/templates/repo/graph/commits.tmpl
+++ b/templates/repo/graph/commits.tmpl
@@ -64,10 +64,10 @@
{{if $commit.User.FullName}}
{{$userName = $commit.User.FullName}}
{{end}}
- {{avatar $commit.User}}
+ {{avatar $.Context $commit.User}}
<a href="{{$commit.User.HomeLink}}">{{$userName}}</a>
{{else}}
- {{avatarByEmail $commit.Commit.Author.Email $userName}}
+ {{avatarByEmail $.Context $commit.Commit.Author.Email $userName}}
{{$userName}}
{{end}}
</span>
diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl
index 96d82d4aa6..4b55e7bec8 100644
--- a/templates/repo/issue/list.tmpl
+++ b/templates/repo/issue/list.tmpl
@@ -128,7 +128,7 @@
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}">{{.locale.Tr "repo.issues.filter_poster_no_select"}}</a>
{{range .Posters}}
<a class="{{if eq $.PosterID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{.ID}}">
- {{avatar .}} {{.GetDisplayName}}
+ {{avatar $.Context .}} {{.GetDisplayName}}
</a>
{{end}}
</div>
@@ -148,7 +148,7 @@
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_assginee_no_select"}}</a>
{{range .Assignees}}
<a class="{{if eq $.AssigneeID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{.ID}}&poster={{$.PosterID}}">
- {{avatar .}} {{.GetDisplayName}}
+ {{avatar $.Context .}} {{.GetDisplayName}}
</a>
{{end}}
</div>
@@ -292,7 +292,7 @@
</div>
{{range .Assignees}}
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/assignee">
- {{avatar .}} {{.GetDisplayName}}
+ {{avatar $.Context .}} {{.GetDisplayName}}
</div>
{{end}}
</div>
diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl
index 45b5b490a9..8d6a97a713 100644
--- a/templates/repo/issue/milestone_issues.tmpl
+++ b/templates/repo/issue/milestone_issues.tmpl
@@ -73,7 +73,7 @@
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&assignee={{$.AssigneeID}}">{{.locale.Tr "repo.issues.filter_poster_no_select"}}</a>
{{range .Posters}}
<a class="{{if eq $.PosterID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&assignee={{$.AssigneeID}}&poster={{.ID}}">
- {{avatar .}} {{.GetDisplayName}}
+ {{avatar $.Context .}} {{.GetDisplayName}}
</a>
{{end}}
</div>
@@ -93,7 +93,7 @@
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_assginee_no_select"}}</a>
{{range .Assignees}}
<a class="{{if eq $.AssigneeID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&assignee={{.ID}}&poster={{$.PosterID}}">
- {{avatar . 28 "gt-mr-2"}}
+ {{avatar $.Context . 28 "gt-mr-2"}}
{{.GetDisplayName}}
</a>
{{end}}
@@ -179,7 +179,7 @@
</div>
{{range .Assignees}}
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/assignee">
- {{avatar . 28 "gt-mr-2"}}
+ {{avatar $.Context . 28 "gt-mr-2"}}
{{.GetDisplayName}}
</div>
{{end}}
diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl
index 84c2c64a72..8fbd9d256a 100644
--- a/templates/repo/issue/new_form.tmpl
+++ b/templates/repo/issue/new_form.tmpl
@@ -8,7 +8,7 @@
<div class="twelve wide column">
<div class="ui comments">
<div class="comment">
- {{template "shared/user/avatarlink" .SignedUser}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .SignedUser}}
<div class="ui segment content">
<div class="field">
<input name="title" id="issue_title" placeholder="{{.locale.Tr "repo.milestones.title"}}" value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" tabindex="3" autofocus required maxlength="255" autocomplete="off">
@@ -217,7 +217,7 @@
<a class="item muted" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}">
<span class="octicon-check invisible">{{svg "octicon-check"}}</span>
<span class="text">
- {{avatar . 28 "gt-mr-3"}}{{.GetDisplayName}}
+ {{avatar $.Context . 28 "gt-mr-3"}}{{.GetDisplayName}}
</span>
</a>
{{end}}
@@ -229,7 +229,7 @@
</span>
{{range .Assignees}}
<a class="hide item gt-p-2 muted" id="assignee_{{.ID}}" href="{{$.RepoLink}}/issues?assignee={{.ID}}">
- {{avatar . 28 "gt-mr-3 gt-vm"}}{{.GetDisplayName}}
+ {{avatar $.Context . 28 "gt-mr-3 gt-vm"}}{{.GetDisplayName}}
</a>
{{end}}
</div>
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl
index b3970d6404..ab419472ed 100644
--- a/templates/repo/issue/view_content.tmpl
+++ b/templates/repo/issue/view_content.tmpl
@@ -23,7 +23,7 @@
<span class="timeline-avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
{{else}}
<a class="timeline-avatar" {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>
- {{avatar .Issue.Poster}}
+ {{avatar $.Context .Issue.Poster}}
</a>
{{end}}
<div class="content comment-container">
@@ -42,7 +42,7 @@
</span>
{{else}}
<a class="inline-timeline-avatar" href="{{.Issue.Poster.HomeLink}}">
- {{avatar .Issue.Poster}}
+ {{avatar $.Context .Issue.Poster}}
</a>
<span class="text grey">
{{template "shared/user/authorlink" .Issue.Poster}}
@@ -101,7 +101,7 @@
{{if and (or .IsRepoAdmin .HasIssuesOrPullsWritePermission (not .Issue.IsLocked)) (not .Repository.IsArchived)}}
<div class="timeline-item comment form">
<a class="timeline-avatar" href="{{.SignedUser.HomeLink}}">
- {{avatar .SignedUser}}
+ {{avatar $.Context .SignedUser}}
</a>
<div class="content">
<form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">
@@ -152,7 +152,7 @@
{{if .Repository.IsArchived}}
<div class="timeline-item comment form">
<a class="timeline-avatar" href="{{.SignedUser.HomeLink}}">
- {{avatar .SignedUser}}
+ {{avatar $.Context .SignedUser}}
</a>
<div class="content">
<form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl
index 90646045d0..0074f3f431 100644
--- a/templates/repo/issue/view_content/comments.tmpl
+++ b/templates/repo/issue/view_content/comments.tmpl
@@ -18,7 +18,7 @@
<span class="timeline-avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
{{else}}
<a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
- {{avatar .Poster}}
+ {{avatar $.Context .Poster}}
</a>
{{end}}
<div class="content comment-container">
@@ -38,7 +38,7 @@
{{else}}
{{if gt .Poster.ID 0}}
<a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}">
- {{avatar .Poster}}
+ {{avatar $.Context .Poster}}
</a>
{{end}}
<span class="text grey muted-links">
@@ -94,7 +94,7 @@
{{else if eq .Type 1}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge gt-bg-green gt-text-white">{{svg "octicon-dot-fill"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if .Issue.IsPull}}
@@ -107,7 +107,7 @@
{{else if eq .Type 2}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge gt-bg-red gt-text-white">{{svg "octicon-circle-slash"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if .Issue.IsPull}}
@@ -120,7 +120,7 @@
{{else if eq .Type 28}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge gt-bg-purple gt-text-white">{{svg "octicon-git-merge"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$link := printf "%s/commit/%s" $.Repository.Link ($.Issue.PullRequest.MergedCommitID|PathEscape)}}
@@ -147,7 +147,7 @@
{{$createdStr:= TimeSinceUnix .CreatedUnix $.locale}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-bookmark"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
{{if eq .RefAction 3}}<del>{{end}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
@@ -162,7 +162,7 @@
{{else if eq .Type 4}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-bookmark"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.commit_ref_at" .EventTag $createdStr | Safe}}
@@ -176,7 +176,7 @@
{{if or .AddedLabels .RemovedLabels}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-tag"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if and .AddedLabels (not .RemovedLabels)}}
@@ -192,7 +192,7 @@
{{else if eq .Type 8}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-milestone"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if gt .OldMilestoneID 0}}{{if gt .MilestoneID 0}}{{$.locale.Tr "repo.issues.change_milestone_at" (.OldMilestone.Name|Escape) (.Milestone.Name|Escape) $createdStr | Safe}}{{else}}{{$.locale.Tr "repo.issues.remove_milestone_at" (.OldMilestone.Name|Escape) $createdStr | Safe}}{{end}}{{else if gt .MilestoneID 0}}{{$.locale.Tr "repo.issues.add_milestone_at" (.Milestone.Name|Escape) $createdStr | Safe}}{{end}}
@@ -203,7 +203,7 @@
<span class="badge">{{svg "octicon-person"}}</span>
{{if gt .AssigneeID 0}}
{{if .RemovedAssignee}}
- {{template "shared/user/avatarlink" .Assignee}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Assignee}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Assignee}}
{{if eq .Poster.ID .Assignee.ID}}
@@ -213,7 +213,7 @@
{{end}}
</span>
{{else}}
- {{template "shared/user/avatarlink" .Assignee}}
+ {{template "shared/user/avatarlink" "user" .Assignee}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Assignee}}
{{if eq .Poster.ID .AssigneeID}}
@@ -228,7 +228,7 @@
{{else if eq .Type 10}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-pencil"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji) (.NewTitle|RenderEmoji) $createdStr | Safe}}
@@ -237,7 +237,7 @@
{{else if eq .Type 11}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-git-branch"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.delete_branch_at" (.OldRef|Escape) $createdStr | Safe}}
@@ -246,7 +246,7 @@
{{else if eq .Type 12}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.start_tracking_history" $createdStr | Safe}}
@@ -255,7 +255,7 @@
{{else if eq .Type 13}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}}
@@ -269,7 +269,7 @@
{{else if eq .Type 14}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.add_time_history" $createdStr | Safe}}
@@ -283,7 +283,7 @@
{{else if eq .Type 15}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.cancel_tracking_history" $createdStr | Safe}}
@@ -292,7 +292,7 @@
{{else if eq .Type 16}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.due_date_added" .Content $createdStr | Safe}}
@@ -301,7 +301,7 @@
{{else if eq .Type 17}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$parsedDeadline := .Content | ParseDeadline}}
@@ -311,7 +311,7 @@
{{else if eq .Type 18}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.due_date_remove" .Content $createdStr | Safe}}
@@ -320,7 +320,7 @@
{{else if eq .Type 19}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-package-dependents"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.dependency.added_dependency" $createdStr | Safe}}
@@ -343,7 +343,7 @@
{{else if eq .Type 20}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-package-dependents"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.dependency.removed_dependency" $createdStr | Safe}}
@@ -369,7 +369,7 @@
{{if .OriginalAuthor}}
{{else}}
<a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
- {{avatar .Poster}}
+ {{avatar $.Context .Poster}}
</a>
{{end}}
<span class="badge{{if eq .Review.Type 1}} gt-bg-green gt-text-white{{else if eq .Review.Type 3}} gt-bg-red gt-text-white{{end}}">{{svg (printf "octicon-%s" .Review.Type.Icon)}}</span>
@@ -529,7 +529,7 @@
<div class="comment-header-left gt-df gt-ac">
{{if not .OriginalAuthor}}
<a class="avatar">
- {{avatar .Poster}}
+ {{avatar $.Context .Poster}}
</a>
{{end}}
<span class="text grey muted-links">
@@ -626,7 +626,7 @@
{{else if eq .Type 23}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-lock"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
{{if .Content}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
@@ -642,7 +642,7 @@
{{else if eq .Type 24}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-key"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.unlock_comment" $createdStr | Safe}}
@@ -651,7 +651,7 @@
{{else if eq .Type 25}}
<div class="timeline-item event">
<span class="badge">{{svg "octicon-git-branch"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
<a{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.Name}}</a>
{{$.locale.Tr "repo.pulls.change_target_branch_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}}
@@ -660,7 +660,7 @@
{{else if eq .Type 26}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
@@ -674,7 +674,7 @@
{{else if eq .Type 27}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-eye"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if (gt .AssigneeID 0)}}
@@ -715,7 +715,7 @@
{{if not $.UnitProjectsGlobalDisabled}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-project"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if gt .OldProjectID 0}}
@@ -734,7 +734,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.AvatarLink}}">
+ <img src="{{.Poster.AvatarLink $.Context}}">
</a>
<span class="badge grey">{{svg "octicon-x" 16}}</span>
<span class="text grey muted-links">
@@ -772,7 +772,7 @@
{{else if eq .Type 33}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-git-branch"}}</span>
- {{template "shared/user/avatarlink" .Poster}}
+ {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if and .OldRef .NewRef}}
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl
index ae463d1b3f..663264171b 100644
--- a/templates/repo/issue/view_content/pull.tmpl
+++ b/templates/repo/issue/view_content/pull.tmpl
@@ -10,7 +10,7 @@
<div class="review-item-left">
{{if .User}}
<a href="{{.User.HomeLink}}">
- {{avatar .User}}
+ {{avatar $.Context .User}}
</a>
{{end}}
<span>
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index 90afe6b85e..9ba46f3715 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -26,7 +26,7 @@
<a class="{{if not .CanChange}}ui tooltip{{end}} item {{if .Checked}} checked {{end}} {{if not .CanChange}}ban-change{{end}}" href="#" data-id="{{.ItemID}}" data-id-selector="#review_request_{{.ItemID}}" {{if not .CanChange}} data-content="{{$.locale.Tr "repo.issues.remove_request_review_block"}}"{{end}}>
<span class="octicon-check {{if not .Checked}}invisible{{end}}">{{svg "octicon-check"}}</span>
<span class="text">
- {{avatar .User 28 "gt-mr-3"}}
+ {{avatar $.Context .User 28 "gt-mr-3"}}
{{.User.GetDisplayName}}
</span>
</a>
@@ -56,7 +56,7 @@
<div class="item gt-mb-2">
{{if .User}}
<a class="muted sidebar-item-link" href="{{.User.HomeLink}}">
- {{avatar .User 28 "gt-mr-3"}}
+ {{avatar $.Context .User 28 "gt-mr-3"}}
{{.User.GetDisplayName}}
</a>
{{else if .Team}}
@@ -288,7 +288,7 @@
{{end}}
<span class="octicon-check {{if not $checked}}invisible{{end}}">{{svg "octicon-check"}}</span>
<span class="text">
- {{avatar . 28 "gt-mr-3"}}
+ {{avatar $.Context . 28 "gt-mr-3"}}
{{.GetDisplayName}}
</span>
</a>
@@ -301,7 +301,7 @@
{{range .Issue.Assignees}}
<div class="item">
<a class="muted sidebar-item-link" href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?assignee={{.ID}}">
- {{avatar . 28 "gt-mr-3"}}
+ {{avatar $.Context . 28 "gt-mr-3"}}
{{.GetDisplayName}}
</a>
</div>
@@ -316,7 +316,7 @@
<div class="ui list gt-df gt-fw">
{{range .Participants}}
<a class="ui tooltip" {{if gt .ID 0}}href="{{.HomeLink}}"{{end}} data-content="{{.GetDisplayName}}" data-position="top center">
- {{avatar . 28 "gt-my-1 gt-mr-2"}}
+ {{avatar $.Context . 28 "gt-my-1 gt-mr-2"}}
</a>
{{end}}
</div>
@@ -393,7 +393,7 @@
{{range $user, $trackedtime := .WorkingUsers}}
<div class="comment gt-mt-3">
<a class="avatar">
- {{avatar $user}}
+ {{avatar $.Context $user}}
</a>
<div class="content">
{{template "shared/user/authorlink" $user}}
diff --git a/templates/repo/migrate/codebase.tmpl b/templates/repo/migrate/codebase.tmpl
index e20bd70e71..5bfd3adc2d 100644
--- a/templates/repo/migrate/codebase.tmpl
+++ b/templates/repo/migrate/codebase.tmpl
@@ -62,18 +62,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
- {{avatar .ContextUser 28 "mini"}}
+ {{avatar $.Context .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
- {{avatar .SignedUser 28 "mini"}}
+ {{avatar $.Context .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
- {{avatar . 28 "mini"}}
+ {{avatar $.Context . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}
diff --git a/templates/repo/migrate/git.tmpl b/templates/repo/migrate/git.tmpl
index 0757948a6c..fb6775e38c 100644
--- a/templates/repo/migrate/git.tmpl
+++ b/templates/repo/migrate/git.tmpl
@@ -36,18 +36,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
- {{avatar .ContextUser}}
+ {{avatar $.Context .ContextUser}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
- {{avatar .SignedUser}}
+ {{avatar $.Context .SignedUser}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
- {{avatar .}}
+ {{avatar $.Context .}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}
diff --git a/templates/repo/migrate/gitbucket.tmpl b/templates/repo/migrate/gitbucket.tmpl
index 020115be6c..e9515beeb2 100644
--- a/templates/repo/migrate/gitbucket.tmpl
+++ b/templates/repo/migrate/gitbucket.tmpl
@@ -78,18 +78,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
- {{avatar .ContextUser 28 "mini"}}
+ {{avatar $.Context .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
- {{avatar .SignedUser 28 "mini"}}
+ {{avatar $.Context .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
- {{avatar . 28 "mini"}}
+ {{avatar $.Context . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}
diff --git a/templates/repo/migrate/gitea.tmpl b/templates/repo/migrate/gitea.tmpl
index ef28e15ee5..ecbf89608e 100644
--- a/templates/repo/migrate/gitea.tmpl
+++ b/templates/repo/migrate/gitea.tmpl
@@ -74,18 +74,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
- {{avatar .ContextUser}}
+ {{avatar $.Context .ContextUser}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
- {{avatar .SignedUser}}
+ {{avatar $.Context .SignedUser}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
- {{avatar .}}
+ {{avatar $.Context .}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}
diff --git a/templates/repo/migrate/github.tmpl b/templates/repo/migrate/github.tmpl
index b6c39134f0..63b5e83a2c 100644
--- a/templates/repo/migrate/github.tmpl
+++ b/templates/repo/migrate/github.tmpl
@@ -76,18 +76,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
- {{avatar .ContextUser 28 "mini"}}
+ {{avatar $.Context .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
- {{avatar .SignedUser 28 "mini"}}
+ {{avatar $.Context .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
- {{avatar . 28 "mini"}}
+ {{avatar $.Context . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}
diff --git a/templates/repo/migrate/gitlab.tmpl b/templates/repo/migrate/gitlab.tmpl
index 454194542e..946b7da37a 100644
--- a/templates/repo/migrate/gitlab.tmpl
+++ b/templates/repo/migrate/gitlab.tmpl
@@ -73,18 +73,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
- {{avatar .ContextUser 28 "mini"}}
+ {{avatar $.Context .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
- {{avatar .SignedUser 28 "mini"}}
+ {{avatar $.Context .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
- {{avatar . 28 "mini"}}
+ {{avatar $.Context . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}
diff --git a/templates/repo/migrate/gogs.tmpl b/templates/repo/migrate/gogs.tmpl
index acd7ec950e..85dbce8164 100644
--- a/templates/repo/migrate/gogs.tmpl
+++ b/templates/repo/migrate/gogs.tmpl
@@ -76,18 +76,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
- {{avatar .ContextUser}}
+ {{avatar $.Context .ContextUser}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
- {{avatar .SignedUser}}
+ {{avatar $.Context .SignedUser}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
- {{avatar .}}
+ {{avatar $.Context .}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}
diff --git a/templates/repo/migrate/onedev.tmpl b/templates/repo/migrate/onedev.tmpl
index ec8c06cc70..8463782ae7 100644
--- a/templates/repo/migrate/onedev.tmpl
+++ b/templates/repo/migrate/onedev.tmpl
@@ -62,18 +62,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
- {{avatar .ContextUser 28 "mini"}}
+ {{avatar $.Context .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
- {{avatar .SignedUser 28 "mini"}}
+ {{avatar $.Context .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
- {{avatar . 28 "mini"}}
+ {{avatar $.Context . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}
diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl
index b27676fdfe..de0911e6cd 100644
--- a/templates/repo/projects/view.tmpl
+++ b/templates/repo/projects/view.tmpl
@@ -249,7 +249,7 @@
{{end}}
<div class="right floated">
{{range .Assignees}}
- <a class="tooltip" target="_blank" href="{{.HomeLink}}" data-content="{{$.locale.Tr "repo.projects.board.assigned_to"}} {{.Name}}">{{avatar . 28 "mini gt-mr-3"}}</a>
+ <a class="tooltip" target="_blank" href="{{.HomeLink}}" data-content="{{$.locale.Tr "repo.projects.board.assigned_to"}} {{.Name}}">{{avatar $.Context . 28 "mini gt-mr-3"}}</a>
{{end}}
</div>
</div>
diff --git a/templates/repo/pulls/fork.tmpl b/templates/repo/pulls/fork.tmpl
index d3e017aa03..930d5afa69 100644
--- a/templates/repo/pulls/fork.tmpl
+++ b/templates/repo/pulls/fork.tmpl
@@ -14,20 +14,20 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
- {{avatar .ContextUser 28 "mini"}}
+ {{avatar $.Context .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
{{if .CanForkToUser}}
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}">
- {{avatar .SignedUser 28 "mini"}}
+ {{avatar $.Context .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{end}}
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
- {{avatar . 28 "mini"}}
+ {{avatar $.Context . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}
diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl
index 8c124162af..66147f8161 100644
--- a/templates/repo/release/list.tmpl
+++ b/templates/repo/release/list.tmpl
@@ -91,7 +91,7 @@
<p class="text grey">
{{if gt .Publisher.ID 0}}
<span class="author">
- {{avatar .Publisher 20}}
+ {{avatar $.Context .Publisher 20}}
<a href="{{.Publisher.HomeLink}}">{{.Publisher.Name}}</a>
</span>
<span class="released">
@@ -138,7 +138,7 @@
{{if .OriginalAuthor}}
{{svg "octicon-mark-github" 16 "gt-mr-2"}}{{.OriginalAuthor}}
{{else if .Publisher}}
- {{avatar .Publisher 20}}
+ {{avatar $.Context .Publisher 20}}
<a href="{{.Publisher.HomeLink}}">{{.Publisher.GetDisplayName}}</a>
{{else}}
Ghost
diff --git a/templates/repo/settings/collaboration.tmpl b/templates/repo/settings/collaboration.tmpl
index 1d0c660367..bee5bc81cd 100644
--- a/templates/repo/settings/collaboration.tmpl
+++ b/templates/repo/settings/collaboration.tmpl
@@ -13,7 +13,7 @@
<div class="item ui grid">
<div class="ui five wide column">
<a href="{{.HomeLink}}">
- {{avatar .}}
+ {{avatar $.Context .}}
{{.DisplayName}}
</a>
</div>
diff --git a/templates/repo/settings/lfs_locks.tmpl b/templates/repo/settings/lfs_locks.tmpl
index 73bfe08ada..ff9648ac12 100644
--- a/templates/repo/settings/lfs_locks.tmpl
+++ b/templates/repo/settings/lfs_locks.tmpl
@@ -35,7 +35,7 @@
</td>
<td>
<a href="{{$.Owner.HomeLink}}">
- {{avatar $.Owner}}
+ {{avatar $.Context $.Owner}}
{{$.Owner.DisplayName}}
</a>
</td>
diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl
index 030b9d0256..88350c5999 100644
--- a/templates/repo/settings/protected_branch.tmpl
+++ b/templates/repo/settings/protected_branch.tmpl
@@ -49,7 +49,7 @@
<div class="menu">
{{range .Users}}
<div class="item" data-value="{{.ID}}">
- {{avatar . 28 "mini"}}
+ {{avatar $.Context . 28 "mini"}}
{{.GetDisplayName}}
</div>
{{end}}
@@ -101,7 +101,7 @@
<div class="menu">
{{range .Users}}
<div class="item" data-value="{{.ID}}">
- {{avatar . 28 "mini"}}
+ {{avatar $.Context . 28 "mini"}}
{{.GetDisplayName}}
</div>
{{end}}
@@ -181,7 +181,7 @@
<div class="menu">
{{range .Users}}
<div class="item" data-value="{{.ID}}">
- {{avatar . 28 "mini"}}
+ {{avatar $.Context . 28 "mini"}}
{{.GetDisplayName}}
</div>
{{end}}
diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl
index 8d36354a16..7b318955ec 100644
--- a/templates/repo/settings/tags.tmpl
+++ b/templates/repo/settings/tags.tmpl
@@ -36,7 +36,7 @@
<div class="menu">
{{range .Users}}
<div class="item" data-value="{{.ID}}">
- {{avatar . 28 "mini"}}
+ {{avatar $.Context . 28 "mini"}}
{{.GetDisplayName}}
</div>
{{end}}
@@ -94,7 +94,7 @@
{{$userIDs := .AllowlistUserIDs}}
{{range $.Users}}
{{if contain $userIDs .ID}}
- <a class="ui basic label" href="{{.HomeLink}}">{{avatar . 26}} {{.GetDisplayName}}</a>
+ <a class="ui basic label" href="{{.HomeLink}}">{{avatar $.Context . 26}} {{.GetDisplayName}}</a>
{{end}}
{{end}}
{{if $.Owner.IsOrganization}}
diff --git a/templates/repo/shabox_badge.tmpl b/templates/repo/shabox_badge.tmpl
index 1965935c78..9590a3fb51 100644
--- a/templates/repo/shabox_badge.tmpl
+++ b/templates/repo/shabox_badge.tmpl
@@ -3,10 +3,10 @@
<div title="{{if eq .verification.TrustStatus "trusted"}}{{else if eq .verification.TrustStatus "untrusted"}}{{$.root.locale.Tr "repo.commits.signed_by_untrusted_user"}}: {{else}}{{$.root.locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}: {{end}}{{.verification.Reason}}">
{{if ne .verification.SigningUser.ID 0}}
{{svg "gitea-lock"}}
- {{avatar .verification.SigningUser 28 "signature"}}
+ {{avatar $.Context .verification.SigningUser 28 "signature"}}
{{else}}
<span title="{{$.root.locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog"}}</span>
- {{avatarByEmail .verification.SigningEmail "" 28 "signature"}}
+ {{avatarByEmail $.Context .verification.SigningEmail "" 28 "signature"}}
{{end}}
</div>
{{else}}
diff --git a/templates/repo/user_cards.tmpl b/templates/repo/user_cards.tmpl
index efc8530820..b7bc3060b2 100644
--- a/templates/repo/user_cards.tmpl
+++ b/templates/repo/user_cards.tmpl
@@ -8,7 +8,7 @@
{{range .Cards}}
<li class="item ui segment">
<a href="{{.HomeLink}}">
- {{avatar .}}
+ {{avatar $.Context .}}
</a>
<h3 class="name"><a href="{{.HomeLink}}">{{.DisplayName}}</a></h3>
diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl
index b8c534da49..45d098d3c5 100644
--- a/templates/repo/view_list.tmpl
+++ b/templates/repo/view_list.tmpl
@@ -6,7 +6,7 @@
<div class="ui active tiny slow centered inline">…</div>
{{else}}
{{if .LatestCommitUser}}
- {{avatar .LatestCommitUser 24}}
+ {{avatar $.Context .LatestCommitUser 24}}
{{if .LatestCommitUser.FullName}}
<a class="muted" href="{{.LatestCommitUser.HomeLink}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
{{else}}
@@ -14,7 +14,7 @@
{{end}}
{{else}}
{{if .LatestCommit.Author}}
- {{avatarByEmail .LatestCommit.Author.Email .LatestCommit.Author.Name 24}}
+ {{avatarByEmail $.Context .LatestCommit.Author.Email .LatestCommit.Author.Name 24}}
<strong>{{.LatestCommit.Author.Name}}</strong>
{{end}}
{{end}}