diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-02-15 21:37:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-15 21:37:34 +0800 |
commit | bd820aa9c52da4568b460a0b8604287f8ed8df26 (patch) | |
tree | 15e59e1d4f705b1c5adbd418ed711dfd602a1b25 /templates | |
parent | 03638f9725de3cda5207384098b38462f56d442e (diff) | |
download | gitea-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')
54 files changed, 146 insertions, 146 deletions
diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl index ef436c718a..6191efcd5e 100644 --- a/templates/admin/user/edit.tmpl +++ b/templates/admin/user/edit.tmpl @@ -162,7 +162,7 @@ <div class="ui attached segment"> <form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data"> {{.CsrfTokenHtml}} - {{if not DisableGravatar}} + {{if not (DisableGravatar $.Context)}} <div class="inline field"> <div class="ui radio checkbox"> <input name="source" value="lookup" type="radio" {{if not .User.UseCustomAvatar}}checked{{end}}> diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 36c4fafd2b..c552dcfd2d 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -32,7 +32,7 @@ {{if .PageIsUserProfile}} <meta property="og:title" content="{{.Owner.DisplayName}}"> <meta property="og:type" content="profile"> - <meta property="og:image" content="{{.Owner.AvatarLink}}"> + <meta property="og:image" content="{{.Owner.AvatarLink $.Context}}"> <meta property="og:url" content="{{.Owner.HTMLURL}}"> {{if .Owner.Description}} <meta property="og:description" content="{{.Owner.Description}}"> @@ -52,10 +52,10 @@ {{end}} {{end}} <meta property="og:type" content="object"> - {{if .Repository.AvatarLink}} - <meta property="og:image" content="{{.Repository.AvatarLink}}"> + {{if (.Repository.AvatarLink $.Context)}} + <meta property="og:image" content="{{.Repository.AvatarLink $.Context}}"> {{else}} - <meta property="og:image" content="{{.Repository.Owner.AvatarLink}}"> + <meta property="og:image" content="{{.Repository.Owner.AvatarLink $.Context}}"> {{end}} {{else}} <meta property="og:title" content="{{AppName}}"> diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index dafc64cad7..059363b72d 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -59,7 +59,7 @@ <div class="right stackable menu"> <div class="ui dropdown jump item tooltip" tabindex="-1" data-content="{{.locale.Tr "user_profile_and_more"}}"> <span class="text"> - {{avatar .SignedUser 24 "tiny"}} + {{avatar $.Context .SignedUser 24 "tiny"}} <span class="sr-only">{{.locale.Tr "user_profile_and_more"}}</span> <span class="mobile-only">{{.SignedUser.Name}}</span> <span class="fitted not-mobile" tabindex="-1">{{svg "octicon-triangle-down"}}</span> @@ -152,7 +152,7 @@ <div class="ui dropdown jump item tooltip gt-mx-0" tabindex="-1" data-content="{{.locale.Tr "user_profile_and_more"}}"> <span class="text"> - {{avatar .SignedUser 24 "tiny"}} + {{avatar $.Context .SignedUser 24 "tiny"}} <span class="sr-only">{{.locale.Tr "user_profile_and_more"}}</span> <span class="mobile-only">{{.SignedUser.Name}}</span> <span class="fitted not-mobile" tabindex="-1">{{svg "octicon-triangle-down"}}</span> diff --git a/templates/base/head_script.tmpl b/templates/base/head_script.tmpl index c4ac18a86e..1b130d9cb4 100644 --- a/templates/base/head_script.tmpl +++ b/templates/base/head_script.tmpl @@ -22,11 +22,11 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly. tributeValues: Array.from(new Map([ {{range .Participants}} ['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}', - name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink}}'}], + name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink $.Context}}'}], {{end}} {{range .Assignees}} ['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}', - name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink}}'}], + name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink $.Context}}'}], {{end}} {{range .MentionableTeams}} ['{{$.MentionableTeamsOrg}}/{{.Name}}', {key: '{{$.MentionableTeamsOrg}}/{{.Name}}', value: '{{$.MentionableTeamsOrg}}/{{.Name}}', diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl index 56c6ee56a0..c763fcffc6 100644 --- a/templates/explore/organizations.tmpl +++ b/templates/explore/organizations.tmpl @@ -7,7 +7,7 @@ <div class="ui user list"> {{range .Users}} <div class="item"> - {{avatar .}} + {{avatar $.Context .}} <div class="content"> <span class="header"> <a href="{{.HomeLink}}">{{.Name}}</a> {{.FullName}} diff --git a/templates/explore/users.tmpl b/templates/explore/users.tmpl index 336daea7c8..aa397e65b7 100644 --- a/templates/explore/users.tmpl +++ b/templates/explore/users.tmpl @@ -7,7 +7,7 @@ <div class="ui user list"> {{range .Users}} <div class="item"> - {{avatar .}} + {{avatar $.Context .}} <div class="content"> <span class="header"><a href="{{.HomeLink}}">{{.Name}}</a> {{.FullName}}</span> <div class="description"> diff --git a/templates/org/header.tmpl b/templates/org/header.tmpl index 1102610e9e..6106fe5d2b 100644 --- a/templates/org/header.tmpl +++ b/templates/org/header.tmpl @@ -3,7 +3,7 @@ <div class="ui vertically grid head"> <div class="column"> <div class="ui header"> - {{avatar . 100}} + {{avatar $.Context . 100}} <span class="text thin grey"><a href="{{.HomeLink}}">{{.DisplayName}}</a></span> <span class="org-visibility"> {{if .Visibility.IsLimited}}<div class="ui medium basic horizontal label">{{$.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 6e7ea7021f..1b3cabbde7 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -1,7 +1,7 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content organization profile"> <div class="ui container gt-df"> - {{avatar .Org 140 "org-avatar"}} + {{avatar $.Context .Org 140 "org-avatar"}} <div id="org-info"> <div class="ui header"> {{.Org.DisplayName}} @@ -52,7 +52,7 @@ {{range .Members}} {{if or $isMember (call $.IsPublicMember .ID)}} <a href="{{.HomeLink}}" title="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}"> - {{avatar .}} + {{avatar $.Context .}} </a> {{end}} {{end}} diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl index b4f788e523..b76cb9778f 100644 --- a/templates/org/member/members.tmpl +++ b/templates/org/member/members.tmpl @@ -8,7 +8,7 @@ {{range .Members}} <div class="item ui grid"> <div class="ui four wide column" style="display: flex;"> - {{avatar . 48}} + {{avatar $.Context . 48}} <div> <div class="meta"><a href="{{.HomeLink}}">{{.Name}}</a></div> <div class="meta">{{.FullName}}</div> diff --git a/templates/org/team/invite.tmpl b/templates/org/team/invite.tmpl index ef365dee3a..55ecd049b3 100644 --- a/templates/org/team/invite.tmpl +++ b/templates/org/team/invite.tmpl @@ -4,7 +4,7 @@ {{template "base/alert" .}} <div class="ui centered card"> <div class="image"> - {{avatar .Organization 140}} + {{avatar $.Context .Organization 140}} </div> <div class="content"> <div class="header">{{.locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name | Str2html}}</div> diff --git a/templates/org/team/members.tmpl b/templates/org/team/members.tmpl index 13bd6c5b5d..6ea1614753 100644 --- a/templates/org/team/members.tmpl +++ b/templates/org/team/members.tmpl @@ -35,7 +35,7 @@ </form> {{end}} <a href="{{.HomeLink}}"> - {{avatar .}} + {{avatar $.Context .}} {{.DisplayName}} </a> </div> diff --git a/templates/org/team/teams.tmpl b/templates/org/team/teams.tmpl index 66ac4a4211..df0620af49 100644 --- a/templates/org/team/teams.tmpl +++ b/templates/org/team/teams.tmpl @@ -32,7 +32,7 @@ </div> <div class="ui attached segment members"> {{range .Members}} - {{template "shared/user/avatarlink" .}} + {{template "shared/user/avatarlink" Dict "Context" $.Context "user" .}} {{end}} </div> <div class="ui bottom attached header"> 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}} diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index b121050930..a246b70093 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -153,7 +153,7 @@ <div class="issue-item-icon-right text grey"> {{range .Assignees}} <a class="ui assignee tooltip gt-tdn" href="{{.HomeLink}}" data-content="{{.GetDisplayName}}" data-position="left center"> - {{avatar .}} + {{avatar $.Context .}} </a> {{end}} </div> diff --git a/templates/shared/user/avatarlink.tmpl b/templates/shared/user/avatarlink.tmpl index 90f5d96700..3e87eee78e 100644 --- a/templates/shared/user/avatarlink.tmpl +++ b/templates/shared/user/avatarlink.tmpl @@ -1 +1 @@ -<a class="avatar"{{if gt .ID 0}} href="{{.HomeLink}}"{{end}}>{{avatar .}}</a> +<a class="avatar"{{if gt .user.ID 0}} href="{{.user.HomeLink}}"{{end}}>{{avatar $.Context .}}</a> diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl index 3bf9b5fcb7..3f156249ff 100644 --- a/templates/user/dashboard/feeds.tmpl +++ b/templates/user/dashboard/feeds.tmpl @@ -1,7 +1,7 @@ {{range .Feeds}} <div class="news"> <div class="ui left"> - {{avatarByAction .}} + {{avatarByAction $.Context .}} </div> <div class="ui grid"> <div class="ui fourteen wide column"> @@ -88,7 +88,7 @@ {{range $push.Commits}} {{$commitLink := printf "%s/commit/%s" $repoLink .Sha1}} <li> - {{avatarHTML ($push.AvatarLink .AuthorEmail) 16 "gt-mr-2" .AuthorName}} + {{avatarHTML ($push.AvatarLink $.Context .AuthorEmail) 16 "gt-mr-2" .AuthorName}} <a class="commit-id gt-mr-2" href="{{$commitLink}}">{{ShortSha .Sha1}}</a> <span class="text truncate light grey"> {{RenderCommitMessage $.Context .Message $repoLink $.ComposeMetas}} diff --git a/templates/user/dashboard/navbar.tmpl b/templates/user/dashboard/navbar.tmpl index ab3d5029d1..719d5b06b9 100644 --- a/templates/user/dashboard/navbar.tmpl +++ b/templates/user/dashboard/navbar.tmpl @@ -3,7 +3,7 @@ <div class="item"> <div class="ui floating dropdown link jump"> <span class="text truncated-item-container"> - {{avatar .ContextUser}} + {{avatar $.Context .ContextUser}} <span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span> {{if .ContextUser.IsOrganization}} <span class="org-visibility"> @@ -19,12 +19,12 @@ </div> <div class="scrolling menu items"> <a class="{{if eq .ContextUser.ID .SignedUser.ID}}active selected{{end}} item truncated-item-container" href="{{AppSubUrl}}/{{if .PageIsIssues}}issues{{else if .PageIsPulls}}pulls{{else if .PageIsMilestonesDashboard}}milestones{{end}}"> - {{avatar .SignedUser}} + {{avatar $.Context .SignedUser}} <span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span> </a> {{range .Orgs}} <a class="{{if eq $.ContextUser.ID .ID}}active selected{{end}} item truncated-item-container" title="{{.Name}}" href="{{.OrganisationLink}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}"> - {{avatar .}} + {{avatar $.Context .}} <span class="truncated-item-name">{{.ShortName 40}}</span> <span class="org-visibility"> {{if .Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{$.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} diff --git a/templates/user/overview/header.tmpl b/templates/user/overview/header.tmpl index 18fbd3070b..eac23fe53f 100644 --- a/templates/user/overview/header.tmpl +++ b/templates/user/overview/header.tmpl @@ -5,7 +5,7 @@ <div class="ui vertically grid head"> <div class="column"> <div class="ui header"> - {{avatar . 100}} + {{avatar $.Context . 100}} <span class="text thin grey"><a href="{{.HomeLink}}">{{.DisplayName}}</a></span> <span class="org-visibility"> {{if .Visibility.IsLimited}}<div class="ui medium basic horizontal label">{{$.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 4de1aea562..fcaec60eae 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -7,11 +7,11 @@ <div id="profile-avatar" class="content gt-df"/> {{if eq .SignedUserName .Owner.Name}} <a class="image tooltip" href="{{AppSubUrl}}/user/settings" data-content="{{.locale.Tr "user.change_avatar"}}" data-position="bottom center"> - {{avatar .Owner 290}} + {{avatar $.Context .Owner 290}} </a> {{else}} <span class="image"> - {{avatar .Owner 290}} + {{avatar $.Context .Owner 290}} </span> {{end}} </div> @@ -63,7 +63,7 @@ {{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.HasMemberWithUserID $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}} <li> <a class="tooltip" href="{{.HomeLink}}" data-content="{{.Name}}" data-position="top center"> - {{avatar .}} + {{avatar $.Context .}} </a> </li> {{end}} diff --git a/templates/user/project.tmpl b/templates/user/project.tmpl index 7016c4d8b7..b46fa1c779 100644 --- a/templates/user/project.tmpl +++ b/templates/user/project.tmpl @@ -14,18 +14,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/user/settings/organization.tmpl b/templates/user/settings/organization.tmpl index 8f1f682abf..cd513db249 100644 --- a/templates/user/settings/organization.tmpl +++ b/templates/user/settings/organization.tmpl @@ -26,7 +26,7 @@ </button> </form> </div> - {{avatar . 28 "mini"}} + {{avatar $.Context . 28 "mini"}} <div class="content"> <a href="{{.HomeLink}}">{{.Name}}</a> </div> diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl index a362bf2c2d..ea9a8bba6d 100644 --- a/templates/user/settings/profile.tmpl +++ b/templates/user/settings/profile.tmpl @@ -101,7 +101,7 @@ <div class="ui attached segment"> <form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data"> {{.CsrfTokenHtml}} - {{if not DisableGravatar}} + {{if not (DisableGravatar $.Context)}} <div class="inline field"> <div class="ui radio checkbox"> <input name="source" value="lookup" type="radio" {{if not .SignedUser.UseCustomAvatar}}checked{{end}}> |