Skip to content

Commit 88a22d1

Browse files
committed
Show fullname on issue edits and gpg/ssh signing info
1 parent 83c9035 commit 88a22d1

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

models/issues/content_history.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ func QueryIssueContentHistoryEditedCountMap(dbCtx context.Context, issueID int64
137137
type IssueContentListItem struct {
138138
UserID int64
139139
UserName string
140+
UserFullName string
140141
UserAvatarLink string
141142

142143
HistoryID int64
@@ -148,7 +149,7 @@ type IssueContentListItem struct {
148149
// FetchIssueContentHistoryList fetch list
149150
func FetchIssueContentHistoryList(dbCtx context.Context, issueID, commentID int64) ([]*IssueContentListItem, error) {
150151
res := make([]*IssueContentListItem, 0)
151-
err := db.GetEngine(dbCtx).Select("u.id as user_id, u.name as user_name,"+
152+
err := db.GetEngine(dbCtx).Select("u.id as user_id, u.name as user_name, u.full_name as user_full_name,"+
152153
"h.id as history_id, h.edited_unix, h.is_first_created, h.is_deleted").
153154
Table([]string{"issue_content_history", "h"}).
154155
Join("LEFT", []string{"user", "u"}, "h.poster_id = u.id").

models/issues/content_history_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ func TestContentHistory(t *testing.T) {
4343
when the refactor of models are done, this test will be possible to be run then with a real `User` model.
4444
*/
4545
type User struct {
46-
ID int64
47-
Name string
46+
ID int64
47+
Name string
48+
FullName string
4849
}
4950
_ = dbEngine.Sync2(&User{})
5051

routers/web/repo/issue_content_history.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"code.gitea.io/gitea/models/unit"
1717
"code.gitea.io/gitea/modules/context"
1818
"code.gitea.io/gitea/modules/log"
19+
"code.gitea.io/gitea/modules/setting"
1920
"code.gitea.io/gitea/modules/timeutil"
2021

2122
"github.com/sergi/go-diff/diffmatchpatch"
@@ -68,9 +69,15 @@ func GetContentHistoryList(ctx *context.Context) {
6869
actionText = ctx.Locale.Tr("repo.issues.content_history.edited")
6970
}
7071
timeSinceText := timeutil.TimeSinceUnix(item.EditedUnix, lang)
72+
73+
username := item.UserName
74+
if setting.UI.DefaultShowFullName {
75+
username = item.UserFullName
76+
}
77+
7178
results = append(results, map[string]interface{}{
7279
"name": fmt.Sprintf("<img class='ui avatar image' src='%s'><strong>%s</strong> %s %s",
73-
html.EscapeString(item.UserAvatarLink), html.EscapeString(item.UserName), actionText, timeSinceText),
80+
html.EscapeString(item.UserAvatarLink), html.EscapeString(username), actionText, timeSinceText),
7481
"value": item.HistoryID,
7582
})
7683
}

templates/repo/commit_page.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@
202202
<span class="ui text mr-3">{{.i18n.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}:</span>
203203
{{end}}
204204
{{avatar .Verification.SigningUser 28}}
205-
<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.Name}}</strong></a>
205+
<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.GetDisplayName}}</strong></a>
206206
{{else}}
207207
<span title="{{.i18n.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog"}}</span>
208208
<span class="ui text">{{.i18n.Tr "repo.commits.signed_by"}}:</span>
209209
{{avatarByEmail .Verification.SigningEmail "" 28}}
210-
<strong>{{.Verification.SigningUser.Name}}</strong>
210+
<strong>{{.Verification.SigningUser.GetDisplayName}}</strong>
211211
{{end}}
212212
{{else}}
213213
{{svg "gitea-unlock" 16 "mr-3"}}

0 commit comments

Comments
 (0)