-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Improve and unify commit author rendering #36094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
8a27f2b
0809e97
8c78ba8
1ec7498
d714d2e
b14c757
8e1e53a
0cde670
c1bbb6b
2a9caf1
bcfd01d
70590b6
108919d
fd9a7a1
bebf591
e632d98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| {{/* Template Attributes: | ||
| * User: The user associated with the commit, if any | ||
| * Commit: The commit | ||
| * Author: The author, currently only the commit page passes this | ||
| * AvatarSize: Avatar size in pixels | ||
| * AuthorBold: Whether to render the author as bold text | ||
| */}} | ||
| <div class="flex-text-inline{{if .AuthorBold}} tw-font-semibold{{end}}"> | ||
| {{if .User}} | ||
| {{ctx.AvatarUtils.Avatar .User .AvatarSize}} | ||
| {{$username := ""}} | ||
| {{if and .User.FullName DefaultShowFullName}} | ||
| {{$username = .User.FullName}} | ||
| {{else if .User.Name}} | ||
| {{$username = .User.Name}} | ||
| {{end}} | ||
|
Comment on lines
+12
to
+16
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No. More complicated. |
||
| <a class="muted author-wrapper" href="{{.User.HomeLink}}" data-tooltip-content="{{$username}}"> | ||
| {{$username}} | ||
| </a> | ||
| {{else if .Author}} | ||
| {{$username := ""}} | ||
| {{if and .Author.FullName DefaultShowFullName}} | ||
| {{$username = .Author.FullName}} | ||
| {{else if .Author.Name}} | ||
| {{$username = .Author.Name}} | ||
| {{else if .Commit.Author.Name}} | ||
| {{$username = .Commit.Author.Name}} | ||
| {{end}} | ||
| {{ctx.AvatarUtils.AvatarByEmail .Author.Email $username .AvatarSize}} | ||
| <span{{if ctx.RootData.IsSigned}} title="{{.Author.Email}}"{{end}}> | ||
| {{if .Author.HomeLink}} | ||
| <a class="muted author-wrapper" href="{{.Author.HomeLink}}"> | ||
| {{$username}} | ||
| </a> | ||
| {{else}} | ||
| {{$username}} | ||
| {{end}} | ||
| </span> | ||
| {{else}} | ||
| {{$username := ""}} | ||
| {{if .Commit.Author.Name}} | ||
| {{$username = .Commit.Author.Name}} | ||
| {{else}} | ||
| {{$username = .Author.Name}} | ||
| {{end}} | ||
| {{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email $username .AvatarSize}} | ||
| <span class="author-wrapper" {{if ctx.RootData.IsSigned}} title="{{.Commit.Author.Email}}"{{end}}> | ||
| {{if .Commit.Author.Name}} | ||
| {{.Commit.Author.Name}} | ||
| {{else}} | ||
| {{.Author.Name}} | ||
| {{end}} | ||
| </span> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have a full picture what the 3 variants of data being passed into here are. Deeper analysis will be needed to determine if any of this can be reduced. All your remaining comments are about this same topic. If you have a better picture of the data passed in, feel free to change it yourself.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I don't have a full picture at the moment either. The details I know were written in #24087 (comment) ( I think I don't have time or motivation to do it at the moment. If you'd like to use the "shared templates", I think you need to make it clear and maintainable, but not leave the problem to the future maintainers .... |
||
| {{end}} | ||
| </div> | ||



There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you should pass so many different structs.
Commitis not really used. What you need is a "git user" or "gitea user".Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit is used for
.Commit.Authorvs.Author. Maybe it can be unified, not sure. The three pages all pass different context variables.