Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-29 13:16:10 +01:00

Commit-Dropdown: Show Author of commit if available (#30272) (#30285)

Backport #30272 by @sebastian-sauer

As in commits page we show the author of the commit in the commits
dropdown and not the committer.

Commits Page:
![Screenshot from 2024-04-03
22-34-41](https://github.com/go-gitea/gitea/assets/1135157/1c7c5c19-6d0a-4176-8a87-7bca6a0c6dc8)

and the same contents in our dropdown:

![image](https://github.com/go-gitea/gitea/assets/1135157/aa094af2-c369-47ac-9c27-ca208d1d03f0)

fixes #29588

Co-authored-by: sebastian-sauer <sauer.sebastian@gmail.com>
(cherry picked from commit c8570b73afb443f8e4f07f0a26939f1ab5c18f94)
This commit is contained in:
Giteabot 2024-04-05 10:00:20 +08:00 committed by Earl Warren
parent e83b6c7cd2
commit 8a9b57500c
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -967,12 +967,12 @@ func GetPullCommits(ctx *gitea_context.Context, issue *issues_model.Issue) ([]Co
for _, commit := range prInfo.Commits { for _, commit := range prInfo.Commits {
var committerOrAuthorName string var committerOrAuthorName string
var commitTime time.Time var commitTime time.Time
if commit.Committer != nil { if commit.Author != nil {
committerOrAuthorName = commit.Committer.Name
commitTime = commit.Committer.When
} else {
committerOrAuthorName = commit.Author.Name committerOrAuthorName = commit.Author.Name
commitTime = commit.Author.When commitTime = commit.Author.When
} else {
committerOrAuthorName = commit.Committer.Name
commitTime = commit.Committer.When
} }
commits = append(commits, CommitInfo{ commits = append(commits, CommitInfo{