mirror of
https://github.com/go-gitea/gitea
synced 2024-12-30 18:45:59 +01:00
Fix action avatar loading (#13909)
Fixes #13883 Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
10b9a6df0d
commit
97ab820acc
@ -77,7 +77,8 @@ func (a *Action) GetOpType() ActionType {
|
||||
return a.OpType
|
||||
}
|
||||
|
||||
func (a *Action) loadActUser() {
|
||||
// LoadActUser loads a.ActUser
|
||||
func (a *Action) LoadActUser() {
|
||||
if a.ActUser != nil {
|
||||
return
|
||||
}
|
||||
@ -105,13 +106,13 @@ func (a *Action) loadRepo() {
|
||||
|
||||
// GetActFullName gets the action's user full name.
|
||||
func (a *Action) GetActFullName() string {
|
||||
a.loadActUser()
|
||||
a.LoadActUser()
|
||||
return a.ActUser.FullName
|
||||
}
|
||||
|
||||
// GetActUserName gets the action's user name.
|
||||
func (a *Action) GetActUserName() string {
|
||||
a.loadActUser()
|
||||
a.LoadActUser()
|
||||
return a.ActUser.Name
|
||||
}
|
||||
|
||||
|
@ -341,6 +341,7 @@ func NewFuncMap() []template.FuncMap {
|
||||
"svg": SVG,
|
||||
"avatar": Avatar,
|
||||
"avatarHTML": AvatarHTML,
|
||||
"avatarByAction": AvatarByAction,
|
||||
"avatarByEmail": AvatarByEmail,
|
||||
"repoAvatar": RepoAvatar,
|
||||
"SortArrow": func(normSort, revSort, urlSort string, isDefault bool) template.HTML {
|
||||
@ -559,6 +560,12 @@ func Avatar(user *models.User, others ...interface{}) template.HTML {
|
||||
return template.HTML("")
|
||||
}
|
||||
|
||||
// AvatarByAction renders user avatars from action. args: action, size (int), class (string)
|
||||
func AvatarByAction(action *models.Action, others ...interface{}) template.HTML {
|
||||
action.LoadActUser()
|
||||
return Avatar(action.ActUser, others...)
|
||||
}
|
||||
|
||||
// RepoAvatar renders repo avatars. args: repo, size(int), class (string)
|
||||
func RepoAvatar(repo *models.Repository, others ...interface{}) template.HTML {
|
||||
size, class := parseOthers(models.DefaultAvatarPixelSize, "ui avatar image", others...)
|
||||
|
@ -1,7 +1,7 @@
|
||||
{{range .Feeds}}
|
||||
<div class="news">
|
||||
<div class="ui left">
|
||||
{{avatar .ActUser}}
|
||||
{{avatarByAction .}}
|
||||
</div>
|
||||
<div class="ui grid">
|
||||
<div class="ui fourteen wide column">
|
||||
|
Loading…
Reference in New Issue
Block a user