From d9bf9c63aff39c1168c88b42212bbec4d46b3554 Mon Sep 17 00:00:00 2001 From: HesterG Date: Fri, 10 Mar 2023 16:10:47 +0800 Subject: [PATCH 01/21] support fullname search --- templates/repo/issue/list.tmpl | 4 ++-- templates/repo/issue/view_content/sidebar.tmpl | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index ca05264e77b62..38e9a36595f9e 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -134,7 +134,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}} {{.GetDisplayName}} + {{avatar $.Context .}} {{.GetDisplayName}} {{if eq .GetDisplayName .FullName}}{{.Name}}{{else}}{{.FullName}}{{end}} {{end}} @@ -154,7 +154,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context .}} {{.GetDisplayName}} + {{avatar $.Context .}} {{.GetDisplayName}} {{if eq .GetDisplayName .FullName}}{{.Name}}{{else}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 29bfac7c27ea2..5c31461a3ec05 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -29,6 +29,9 @@ {{avatar $.Context .User 28 "gt-mr-3"}} {{.User.GetDisplayName}} + + {{if eq .User.GetDisplayName .User.FullName}}{{.User.Name}}{{else}}{{.User.FullName}}{{end}} + {{end}} {{end}} @@ -303,6 +306,9 @@ {{avatar $.Context . 28 "gt-mr-3"}} {{.GetDisplayName}} + + {{if eq .GetDisplayName .FullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{end}} From 8a8b4bb186b0cf89bce96a7efba40efd8213b788 Mon Sep 17 00:00:00 2001 From: HesterG Date: Mon, 13 Mar 2023 18:41:57 +0800 Subject: [PATCH 02/21] pass ui setting to template --- routers/web/repo/issue.go | 2 +- templates/repo/issue/list.tmpl | 4 ++-- templates/repo/issue/view_content/sidebar.tmpl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 3715320f10c84..a8b3457a58a0f 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1847,7 +1847,7 @@ func ViewIssue(ctx *context.Context) { ctx.Data["ShouldShowCommentType"] = func(commentType issues_model.CommentType) bool { return hiddenCommentTypes == nil || hiddenCommentTypes.Bit(int(commentType)) == 0 } - + ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplIssueView) } diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 38e9a36595f9e..2fcf21fa95e96 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -134,7 +134,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}} {{.GetDisplayName}} {{if eq .GetDisplayName .FullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{avatar $.Context .}} {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} {{end}} @@ -154,7 +154,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context .}} {{.GetDisplayName}} {{if eq .GetDisplayName .FullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{avatar $.Context .}} {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index e6ffa73e55ab8..aec3194775f5f 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -30,7 +30,7 @@ {{.User.GetDisplayName}} - {{if eq .User.GetDisplayName .User.FullName}}{{.User.Name}}{{else}}{{.User.FullName}}{{end}} + {{if $.isShowFullName}}{{.User.Name}}{{else}}{{.User.FullName}}{{end}} {{end}} From 15faa66a4e05447d76af3707d4b9636281f5a553 Mon Sep 17 00:00:00 2001 From: HesterG Date: Mon, 13 Mar 2023 18:43:06 +0800 Subject: [PATCH 03/21] pass bool --- templates/repo/issue/view_content/sidebar.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index aec3194775f5f..a75c01fabfdcd 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -265,7 +265,7 @@ {{.GetDisplayName}} - {{if eq .GetDisplayName .FullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} {{end}} From 7b4f594239682a0de2c0c71cdd441ae2dbde592d Mon Sep 17 00:00:00 2001 From: HesterG Date: Mon, 13 Mar 2023 18:53:33 +0800 Subject: [PATCH 04/21] update --- routers/web/repo/issue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index a8b3457a58a0f..274286b952398 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1834,6 +1834,7 @@ func ViewIssue(ctx *context.Context) { ctx.Data["IsRepoAdmin"] = ctx.IsSigned && (ctx.Repo.IsAdmin() || ctx.Doer.IsAdmin) ctx.Data["LockReasons"] = setting.Repository.Issue.LockReasons ctx.Data["RefEndName"] = git.RefEndName(issue.Ref) + ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName var hiddenCommentTypes *big.Int if ctx.IsSigned { @@ -1847,7 +1848,6 @@ func ViewIssue(ctx *context.Context) { ctx.Data["ShouldShowCommentType"] = func(commentType issues_model.CommentType) bool { return hiddenCommentTypes == nil || hiddenCommentTypes.Bit(int(commentType)) == 0 } - ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplIssueView) } From 888cd090a6764c067ef767bdded3eede167c85d2 Mon Sep 17 00:00:00 2001 From: HesterG Date: Mon, 13 Mar 2023 18:54:09 +0800 Subject: [PATCH 05/21] remove unnecessary change --- routers/web/repo/issue.go | 1 + 1 file changed, 1 insertion(+) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 274286b952398..7b2ac23d46ea5 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1848,6 +1848,7 @@ func ViewIssue(ctx *context.Context) { ctx.Data["ShouldShowCommentType"] = func(commentType issues_model.CommentType) bool { return hiddenCommentTypes == nil || hiddenCommentTypes.Bit(int(commentType)) == 0 } + ctx.HTML(http.StatusOK, tplIssueView) } From 8edc4de2567423046b5a84952071e60ca86f7112 Mon Sep 17 00:00:00 2001 From: HesterG Date: Tue, 14 Mar 2023 11:25:42 +0800 Subject: [PATCH 06/21] fullname support added to search user related --- templates/repo/issue/milestone_issues.tmpl | 7 ++++++- templates/repo/issue/new_form.tmpl | 2 +- templates/repo/settings/protected_branch.tmpl | 6 +++--- templates/repo/settings/tags.tmpl | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 2918c4359f9d7..8cc920b8f521a 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -70,10 +70,14 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} @@ -95,6 +99,7 @@ {{avatar $.Context . 28 "gt-mr-2"}} {{.GetDisplayName}} + {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index a99ceb0451484..85a5ff8eeb6e2 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -186,7 +186,7 @@ - {{avatar $.Context . 28 "gt-mr-3"}}{{.GetDisplayName}} + {{avatar $.Context . 28 "gt-mr-3"}}{{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index 88350c599956b..227a9126ab3f4 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -50,7 +50,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.GetDisplayName}} + {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}}
{{end}} @@ -102,7 +102,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.GetDisplayName}} + {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}}
{{end}} @@ -182,7 +182,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.GetDisplayName}} + {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}}
{{end}} diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl index 7b318955ec45b..3c167d893ddbb 100644 --- a/templates/repo/settings/tags.tmpl +++ b/templates/repo/settings/tags.tmpl @@ -37,7 +37,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.GetDisplayName}} + {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}}
{{end}} From d43597f3e09208a833afbe0ed9f68364a3d769e7 Mon Sep 17 00:00:00 2001 From: HesterG Date: Tue, 14 Mar 2023 12:13:08 +0800 Subject: [PATCH 07/21] add ctx --- routers/web/repo/compare.go | 2 ++ routers/web/repo/issue.go | 2 ++ routers/web/repo/milestone.go | 2 ++ routers/web/repo/setting_protected_branch.go | 1 + routers/web/repo/tag.go | 1 + templates/repo/issue/list.tmpl | 2 +- templates/repo/issue/view_content/sidebar.tmpl | 2 +- 7 files changed, 10 insertions(+), 2 deletions(-) diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index f21611c6348dd..56197c4749c0d 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -826,6 +826,8 @@ func CompareDiff(ctx *context.Context) { ctx.Data["AllowMaintainerEdit"] = false } + ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName + ctx.HTML(http.StatusOK, tplCompare) } diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 7b2ac23d46ea5..969496c0fa132 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -455,6 +455,7 @@ func Issues(ctx *context.Context) { } ctx.Data["CanWriteIssuesOrPulls"] = ctx.Repo.CanWriteIssuesOrPulls(isPullList) + ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplIssues) } @@ -906,6 +907,7 @@ func NewIssue(ctx *context.Context) { } ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWrite(unit.TypeIssues) + ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplIssueNew) } diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go index d712df1001bc3..a539825b70290 100644 --- a/routers/web/repo/milestone.go +++ b/routers/web/repo/milestone.go @@ -294,5 +294,7 @@ func MilestoneIssuesAndPulls(ctx *context.Context) { ctx.Data["CanWriteIssues"] = ctx.Repo.CanWriteIssuesOrPulls(false) ctx.Data["CanWritePulls"] = ctx.Repo.CanWriteIssuesOrPulls(true) + ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName + ctx.HTML(http.StatusOK, tplMilestoneIssues) } diff --git a/routers/web/repo/setting_protected_branch.go b/routers/web/repo/setting_protected_branch.go index 34e84c4656827..fb007bc80e2ab 100644 --- a/routers/web/repo/setting_protected_branch.go +++ b/routers/web/repo/setting_protected_branch.go @@ -40,6 +40,7 @@ func ProtectedBranchRules(ctx *context.Context) { return } ctx.Data["ProtectedBranches"] = rules + ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplBranches) } diff --git a/routers/web/repo/tag.go b/routers/web/repo/tag.go index 95bc6dfce7f80..3a92283efe652 100644 --- a/routers/web/repo/tag.go +++ b/routers/web/repo/tag.go @@ -24,6 +24,7 @@ func Tags(ctx *context.Context) { if setTagsContext(ctx) != nil { return } + ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplTags) } diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 2fcf21fa95e96..8081e683e5272 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -134,7 +134,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}} {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{avatar $.Context .}} {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{$.isShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index a75c01fabfdcd..2aeb3f5c9b791 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -264,7 +264,7 @@ {{avatar $.Context . 28 "gt-mr-3"}} {{.GetDisplayName}} - + {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} From 61fcdd6138e16168f753a12363f66d4d26072ea8 Mon Sep 17 00:00:00 2001 From: HesterG Date: Tue, 14 Mar 2023 14:14:46 +0800 Subject: [PATCH 08/21] use config to decide if show fullname in search --- routers/web/repo/setting_protected_branch.go | 2 +- templates/repo/issue/list.tmpl | 4 ++-- templates/repo/issue/milestone_issues.tmpl | 6 +++--- templates/repo/issue/new_form.tmpl | 2 +- templates/repo/issue/view_content/sidebar.tmpl | 12 ++++-------- templates/repo/settings/protected_branch.tmpl | 6 +++--- templates/repo/settings/tags.tmpl | 2 +- 7 files changed, 15 insertions(+), 19 deletions(-) diff --git a/routers/web/repo/setting_protected_branch.go b/routers/web/repo/setting_protected_branch.go index fb007bc80e2ab..3eb1a56654c58 100644 --- a/routers/web/repo/setting_protected_branch.go +++ b/routers/web/repo/setting_protected_branch.go @@ -40,7 +40,6 @@ func ProtectedBranchRules(ctx *context.Context) { return } ctx.Data["ProtectedBranches"] = rules - ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplBranches) } @@ -153,6 +152,7 @@ func SettingsProtectedBranch(c *context.Context) { } c.Data["Rule"] = rule + c.Data["isShowFullName"] = setting.UI.DefaultShowFullName c.HTML(http.StatusOK, tplProtectedBranch) } diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index fb63c9cbc0274..d5f86afce46c6 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -134,7 +134,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}} {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{$.isShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context .}} {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}} {{end}} @@ -154,7 +154,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context .}} {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{avatar $.Context .}} {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 7679cc40ead5b..8d66cfb8e5abe 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -77,7 +77,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}} {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{avatar $.Context .}} {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}} {{end}} @@ -98,8 +98,8 @@ {{range .Assignees}} {{avatar $.Context . 28 "gt-mr-2"}} - {{.GetDisplayName}} - {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{.Name}} + {{if $.isShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 85a5ff8eeb6e2..8432e6a7e3ed2 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -186,7 +186,7 @@ - {{avatar $.Context . 28 "gt-mr-3"}}{{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{avatar $.Context . 28 "gt-mr-3"}}{{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 4fa1bf66dd9f4..758f2e5aa643e 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -27,11 +27,9 @@ {{svg "octicon-check"}} {{avatar $.Context .User 28 "gt-mr-3"}} - {{.User.GetDisplayName}} - - - {{if $.isShowFullName}}{{.User.Name}}{{else}}{{.User.FullName}}{{end}} + {{.User.Name}} + {{if $.isShowFullName}}{{.User.FullName}}{{end}} {{end}} {{end}} @@ -262,11 +260,9 @@ {{svg "octicon-check"}} {{avatar $.Context . 28 "gt-mr-3"}} - {{.GetDisplayName}} - - - {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{.Name}} + {{if $.isShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index 227a9126ab3f4..c185e4cbfcc50 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -50,7 +50,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}}
{{end}} @@ -102,7 +102,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}}
{{end}} @@ -182,7 +182,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}}
{{end}} diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl index 3c167d893ddbb..ce9a85f04e54f 100644 --- a/templates/repo/settings/tags.tmpl +++ b/templates/repo/settings/tags.tmpl @@ -37,7 +37,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.GetDisplayName}} {{if $.isShowFullName}}{{.Name}}{{else}}{{.FullName}}{{end}} + {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}}
{{end}} From 27f57a3950e219158c2b974555a7509f2e85f967 Mon Sep 17 00:00:00 2001 From: HesterG Date: Tue, 14 Mar 2023 14:54:41 +0800 Subject: [PATCH 09/21] rename isShowFullName to IsShowFullName --- routers/web/repo/compare.go | 2 +- routers/web/repo/issue.go | 6 +++--- routers/web/repo/milestone.go | 2 +- routers/web/repo/tag.go | 2 +- templates/repo/issue/list.tmpl | 4 ++-- templates/repo/issue/milestone_issues.tmpl | 4 ++-- templates/repo/issue/new_form.tmpl | 2 +- templates/repo/issue/view_content/sidebar.tmpl | 4 ++-- templates/repo/settings/protected_branch.tmpl | 6 +++--- templates/repo/settings/tags.tmpl | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index 56197c4749c0d..e61f749c3ecec 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -826,7 +826,7 @@ func CompareDiff(ctx *context.Context) { ctx.Data["AllowMaintainerEdit"] = false } - ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName + ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplCompare) } diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 969496c0fa132..b13e3a3cccc83 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -455,7 +455,7 @@ func Issues(ctx *context.Context) { } ctx.Data["CanWriteIssuesOrPulls"] = ctx.Repo.CanWriteIssuesOrPulls(isPullList) - ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName + ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplIssues) } @@ -907,7 +907,7 @@ func NewIssue(ctx *context.Context) { } ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWrite(unit.TypeIssues) - ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName + ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplIssueNew) } @@ -1836,7 +1836,7 @@ func ViewIssue(ctx *context.Context) { ctx.Data["IsRepoAdmin"] = ctx.IsSigned && (ctx.Repo.IsAdmin() || ctx.Doer.IsAdmin) ctx.Data["LockReasons"] = setting.Repository.Issue.LockReasons ctx.Data["RefEndName"] = git.RefEndName(issue.Ref) - ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName + ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName var hiddenCommentTypes *big.Int if ctx.IsSigned { diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go index a539825b70290..9ef2f8f9aecaa 100644 --- a/routers/web/repo/milestone.go +++ b/routers/web/repo/milestone.go @@ -294,7 +294,7 @@ func MilestoneIssuesAndPulls(ctx *context.Context) { ctx.Data["CanWriteIssues"] = ctx.Repo.CanWriteIssuesOrPulls(false) ctx.Data["CanWritePulls"] = ctx.Repo.CanWriteIssuesOrPulls(true) - ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName + ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplMilestoneIssues) } diff --git a/routers/web/repo/tag.go b/routers/web/repo/tag.go index 3a92283efe652..4bf2fcb93089b 100644 --- a/routers/web/repo/tag.go +++ b/routers/web/repo/tag.go @@ -24,7 +24,7 @@ func Tags(ctx *context.Context) { if setTagsContext(ctx) != nil { return } - ctx.Data["isShowFullName"] = setting.UI.DefaultShowFullName + ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplTags) } diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index d5f86afce46c6..95f0c40d609a0 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -134,7 +134,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}} {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} @@ -154,7 +154,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context .}} {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 8d66cfb8e5abe..f8db4ca75d0e6 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -77,7 +77,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}} {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} @@ -99,7 +99,7 @@ {{avatar $.Context . 28 "gt-mr-2"}} {{.Name}} - {{if $.isShowFullName}}{{.FullName}}{{end}} + {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 8432e6a7e3ed2..77d974fd77ecc 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -186,7 +186,7 @@ - {{avatar $.Context . 28 "gt-mr-3"}}{{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context . 28 "gt-mr-3"}}{{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 758f2e5aa643e..42a759862ad06 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -29,7 +29,7 @@ {{avatar $.Context .User 28 "gt-mr-3"}} {{.User.Name}}
- {{if $.isShowFullName}}{{.User.FullName}}{{end}} + {{if $.IsShowFullName}}{{.User.FullName}}{{end}} {{end}} {{end}} @@ -262,7 +262,7 @@ {{avatar $.Context . 28 "gt-mr-3"}} {{.Name}} - {{if $.isShowFullName}}{{.FullName}}{{end}} + {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index c185e4cbfcc50..36aececb38fde 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -50,7 +50,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}} + {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}}
{{end}} @@ -102,7 +102,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}} + {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}}
{{end}} @@ -182,7 +182,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}} + {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}}
{{end}} diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl index ce9a85f04e54f..e5ec4c8563d6e 100644 --- a/templates/repo/settings/tags.tmpl +++ b/templates/repo/settings/tags.tmpl @@ -37,7 +37,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.Name}} {{if $.isShowFullName}}{{.FullName}}{{end}} + {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}}
{{end}} From 1e30e66d6d3d39889523fbb5a091e6eaa99de378 Mon Sep 17 00:00:00 2001 From: HesterG Date: Tue, 14 Mar 2023 14:56:32 +0800 Subject: [PATCH 10/21] rename --- routers/web/repo/setting_protected_branch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/setting_protected_branch.go b/routers/web/repo/setting_protected_branch.go index 3eb1a56654c58..7017dbbad3fa3 100644 --- a/routers/web/repo/setting_protected_branch.go +++ b/routers/web/repo/setting_protected_branch.go @@ -152,7 +152,7 @@ func SettingsProtectedBranch(c *context.Context) { } c.Data["Rule"] = rule - c.Data["isShowFullName"] = setting.UI.DefaultShowFullName + c.Data["IsShowFullName"] = setting.UI.DefaultShowFullName c.HTML(http.StatusOK, tplProtectedBranch) } From c110521cbe9db001fcdcdcfdc19c228fc2b039d2 Mon Sep 17 00:00:00 2001 From: HesterG Date: Tue, 14 Mar 2023 15:54:27 +0800 Subject: [PATCH 11/21] move inline css to less --- templates/repo/issue/list.tmpl | 4 ++-- templates/repo/issue/milestone_issues.tmpl | 4 ++-- templates/repo/issue/new_form.tmpl | 2 +- templates/repo/issue/view_content/sidebar.tmpl | 4 ++-- templates/repo/settings/protected_branch.tmpl | 6 +++--- templates/repo/settings/tags.tmpl | 2 +- web_src/less/_repository.less | 4 ++++ 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 95f0c40d609a0..c6e8601fb7ca3 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -134,7 +134,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} @@ -154,7 +154,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index f8db4ca75d0e6..fcc1243827c4f 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -77,7 +77,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} @@ -99,7 +99,7 @@ {{avatar $.Context . 28 "gt-mr-2"}} {{.Name}} - {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 77d974fd77ecc..a1fb7c30a6dc7 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -186,7 +186,7 @@ - {{avatar $.Context . 28 "gt-mr-3"}}{{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context . 28 "gt-mr-3"}}{{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 42a759862ad06..1c467ca345523 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -29,7 +29,7 @@ {{avatar $.Context .User 28 "gt-mr-3"}} {{.User.Name}} - {{if $.IsShowFullName}}{{.User.FullName}}{{end}} + {{if $.IsShowFullName}}{{.User.FullName}}{{end}} {{end}} {{end}} @@ -262,7 +262,7 @@ {{avatar $.Context . 28 "gt-mr-3"}} {{.Name}} - {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index 36aececb38fde..ecabc9bd7c1b5 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -50,7 +50,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}}
{{end}} @@ -102,7 +102,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}}
{{end}} @@ -182,7 +182,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}}
{{end}} diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl index e5ec4c8563d6e..219059a77f621 100644 --- a/templates/repo/settings/tags.tmpl +++ b/templates/repo/settings/tags.tmpl @@ -37,7 +37,7 @@ {{range .Users}}
{{avatar $.Context . 28 "mini"}} - {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}}
{{end}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 0069a31cecb40..1931c5bce5626 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -2463,6 +2463,10 @@ padding-top: 9px !important; padding-bottom: 9px !important; } + + .search-fullname { + color: var(--color-text-light-2); + } } // End of .repository From d581a20e12010807d83e4055bebbabef8b1dd6a8 Mon Sep 17 00:00:00 2001 From: HesterG Date: Tue, 14 Mar 2023 17:33:45 +0800 Subject: [PATCH 12/21] use GetSearchNameHTML instead of passing contexts --- models/user/user.go | 8 ++++++++ routers/web/repo/compare.go | 2 -- routers/web/repo/issue.go | 3 --- routers/web/repo/milestone.go | 2 -- routers/web/repo/setting_protected_branch.go | 1 - routers/web/repo/tag.go | 1 - templates/repo/issue/list.tmpl | 4 ++-- templates/repo/issue/milestone_issues.tmpl | 6 ++---- templates/repo/issue/new_form.tmpl | 2 +- templates/repo/issue/view_content/sidebar.tmpl | 8 ++------ templates/repo/settings/protected_branch.tmpl | 9 +++------ templates/repo/settings/tags.tmpl | 3 +-- 12 files changed, 19 insertions(+), 30 deletions(-) diff --git a/models/user/user.go b/models/user/user.go index 454779b9ea361..d667e437498f1 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -8,6 +8,7 @@ import ( "context" "encoding/hex" "fmt" + "html/template" "net/url" "os" "path/filepath" @@ -420,6 +421,13 @@ func (u *User) GetDisplayName() string { return u.Name } +func (u *User) GetSearchNameHTML() template.HTML { + if setting.UI.DefaultShowFullName { + return template.HTML(fmt.Sprintf(`%s %s`, u.Name, strings.TrimSpace(u.FullName))) + } + return template.HTML(u.Name) +} + func gitSafeName(name string) string { return strings.TrimSpace(strings.NewReplacer("\n", "", "<", "", ">", "").Replace(name)) } diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index e61f749c3ecec..f21611c6348dd 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -826,8 +826,6 @@ func CompareDiff(ctx *context.Context) { ctx.Data["AllowMaintainerEdit"] = false } - ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName - ctx.HTML(http.StatusOK, tplCompare) } diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index b13e3a3cccc83..3715320f10c84 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -455,7 +455,6 @@ func Issues(ctx *context.Context) { } ctx.Data["CanWriteIssuesOrPulls"] = ctx.Repo.CanWriteIssuesOrPulls(isPullList) - ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplIssues) } @@ -907,7 +906,6 @@ func NewIssue(ctx *context.Context) { } ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWrite(unit.TypeIssues) - ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplIssueNew) } @@ -1836,7 +1834,6 @@ func ViewIssue(ctx *context.Context) { ctx.Data["IsRepoAdmin"] = ctx.IsSigned && (ctx.Repo.IsAdmin() || ctx.Doer.IsAdmin) ctx.Data["LockReasons"] = setting.Repository.Issue.LockReasons ctx.Data["RefEndName"] = git.RefEndName(issue.Ref) - ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName var hiddenCommentTypes *big.Int if ctx.IsSigned { diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go index 9ef2f8f9aecaa..d712df1001bc3 100644 --- a/routers/web/repo/milestone.go +++ b/routers/web/repo/milestone.go @@ -294,7 +294,5 @@ func MilestoneIssuesAndPulls(ctx *context.Context) { ctx.Data["CanWriteIssues"] = ctx.Repo.CanWriteIssuesOrPulls(false) ctx.Data["CanWritePulls"] = ctx.Repo.CanWriteIssuesOrPulls(true) - ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName - ctx.HTML(http.StatusOK, tplMilestoneIssues) } diff --git a/routers/web/repo/setting_protected_branch.go b/routers/web/repo/setting_protected_branch.go index 7017dbbad3fa3..34e84c4656827 100644 --- a/routers/web/repo/setting_protected_branch.go +++ b/routers/web/repo/setting_protected_branch.go @@ -152,7 +152,6 @@ func SettingsProtectedBranch(c *context.Context) { } c.Data["Rule"] = rule - c.Data["IsShowFullName"] = setting.UI.DefaultShowFullName c.HTML(http.StatusOK, tplProtectedBranch) } diff --git a/routers/web/repo/tag.go b/routers/web/repo/tag.go index 4bf2fcb93089b..95bc6dfce7f80 100644 --- a/routers/web/repo/tag.go +++ b/routers/web/repo/tag.go @@ -24,7 +24,6 @@ func Tags(ctx *context.Context) { if setTagsContext(ctx) != nil { return } - ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplTags) } diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index c6e8601fb7ca3..001cebc331c36 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -134,7 +134,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context .}}{{.GetSearchNameHTML}} {{end}} @@ -154,7 +154,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context .}}{{.GetSearchNameHTML}} {{end}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index fcc1243827c4f..261d35fe295b7 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -77,7 +77,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context .}}{{.GetSearchNameHTML}} {{end}} @@ -97,9 +97,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context . 28 "gt-mr-2"}} - {{.Name}} - {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context . 28 "gt-mr-2"}}{{.GetSearchNameHTML}} {{end}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index a1fb7c30a6dc7..0d198d337d68e 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -186,7 +186,7 @@ - {{avatar $.Context . 28 "gt-mr-3"}}{{.Name}} {{if $.IsShowFullName}}{{.FullName}}{{end}} + {{avatar $.Context . 28 "gt-mr-3"}}{{.GetSearchNameHTML}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 1c467ca345523..997d13f94daee 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -26,10 +26,8 @@ {{svg "octicon-check"}} - {{avatar $.Context .User 28 "gt-mr-3"}} - {{.User.Name}} + {{avatar $.Context .User 28 "gt-mr-3"}}{{.User.GetSearchNameHTML}} - {{if $.IsShowFullName}}{{.User.FullName}}{{end}} {{end}} {{end}} @@ -259,10 +257,8 @@ {{end}} {{svg "octicon-check"}} - {{avatar $.Context . 28 "gt-mr-3"}} - {{.Name}} + {{avatar $.Context . 28 "gt-mr-3"}}{{.GetSearchNameHTML}} - {{if $.IsShowFullName}}{{.FullName}}{{end}} {{end}} diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index ecabc9bd7c1b5..66479e34330e2 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -49,8 +49,7 @@ @@ -101,8 +100,7 @@ @@ -181,8 +179,7 @@ diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl index 219059a77f621..417ce0d17ebcb 100644 --- a/templates/repo/settings/tags.tmpl +++ b/templates/repo/settings/tags.tmpl @@ -36,8 +36,7 @@ From aded8c1c979cbcf24e1456b806d703be6b988433 Mon Sep 17 00:00:00 2001 From: HesterG Date: Tue, 14 Mar 2023 17:46:45 +0800 Subject: [PATCH 13/21] show fullname only it is not empty --- models/user/user.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/models/user/user.go b/models/user/user.go index d667e437498f1..eb059160da0e1 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -423,7 +423,10 @@ func (u *User) GetDisplayName() string { func (u *User) GetSearchNameHTML() template.HTML { if setting.UI.DefaultShowFullName { - return template.HTML(fmt.Sprintf(`%s %s`, u.Name, strings.TrimSpace(u.FullName))) + trimmed := strings.TrimSpace(u.FullName) + if len(trimmed) > 0 { + return template.HTML(fmt.Sprintf(`%s %s`, u.Name, trimmed)) + } } return template.HTML(u.Name) } From 3f8e4473eccd5ab6585a34a4fb0847f014f0f95f Mon Sep 17 00:00:00 2001 From: HesterG Date: Tue, 14 Mar 2023 18:15:04 +0800 Subject: [PATCH 14/21] escape strings --- models/user/user.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/models/user/user.go b/models/user/user.go index 7119ee5604cd8..107bd602dd508 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -8,6 +8,7 @@ import ( "context" "encoding/hex" "fmt" + "html" "html/template" "net/url" "os" @@ -425,10 +426,10 @@ func (u *User) GetSearchNameHTML() template.HTML { if setting.UI.DefaultShowFullName { trimmed := strings.TrimSpace(u.FullName) if len(trimmed) > 0 { - return template.HTML(fmt.Sprintf(`%s %s`, u.Name, trimmed)) + return template.HTML(fmt.Sprintf(`%s %s`, html.EscapeString(u.Name), html.EscapeString(trimmed))) } } - return template.HTML(u.Name) + return template.HTML(html.EscapeString(u.Name)) } func gitSafeName(name string) string { From 6ae196817c687e7a6f14c5b18deb13c4e012e0e1 Mon Sep 17 00:00:00 2001 From: HesterG Date: Wed, 15 Mar 2023 11:40:51 +0800 Subject: [PATCH 15/21] fix conflict --- web_src/less/_repository.less | 4 ---- 1 file changed, 4 deletions(-) diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index a6936ecf49655..c842c4ca658d4 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -2457,10 +2457,6 @@ padding-top: 9px !important; padding-bottom: 9px !important; } - - .search-fullname { - color: var(--color-text-light-2); - } } // End of .repository From c500ce879b12bd235531e16e1768ab21e0cde888 Mon Sep 17 00:00:00 2001 From: HesterG Date: Wed, 15 Mar 2023 11:43:52 +0800 Subject: [PATCH 16/21] add css --- web_src/css/repository.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web_src/css/repository.css b/web_src/css/repository.css index ad2ac49b9984a..4913bc43f27ee 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -3627,3 +3627,7 @@ td.blob-excerpt { .pr-status .status-details > span { padding-right: 0.5em; /* To match the alignment with the "required" label */ } + +.search-fullname { + color: var(--color-text-light-2); +} \ No newline at end of file From be584139b55761e75481f3c46b964d70d8765291 Mon Sep 17 00:00:00 2001 From: HesterG Date: Wed, 15 Mar 2023 12:18:45 +0800 Subject: [PATCH 17/21] new line --- web_src/css/repository.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/css/repository.css b/web_src/css/repository.css index 4913bc43f27ee..bebe3ff8f49fd 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -3630,4 +3630,4 @@ td.blob-excerpt { .search-fullname { color: var(--color-text-light-2); -} \ No newline at end of file +} From 084a2ac6d23ea091961bb1c78168d55b3b6f6af8 Mon Sep 17 00:00:00 2001 From: HesterG Date: Wed, 15 Mar 2023 13:28:59 +0800 Subject: [PATCH 18/21] use template instead of server generate --- models/user/user.go | 12 ------------ routers/web/repo/compare.go | 2 ++ routers/web/repo/issue.go | 3 +++ routers/web/repo/milestone.go | 1 + routers/web/repo/setting_protected_branch.go | 1 + routers/web/repo/tag.go | 1 + templates/repo/issue/list.tmpl | 4 ++-- templates/repo/issue/milestone_issues.tmpl | 4 ++-- templates/repo/issue/new_form.tmpl | 2 +- templates/repo/issue/view_content/sidebar.tmpl | 4 ++-- templates/repo/search_name.tmpl | 1 + templates/repo/settings/protected_branch.tmpl | 6 +++--- templates/repo/settings/tags.tmpl | 2 +- 13 files changed, 20 insertions(+), 23 deletions(-) create mode 100644 templates/repo/search_name.tmpl diff --git a/models/user/user.go b/models/user/user.go index 107bd602dd508..82c2d3b6cdc10 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -8,8 +8,6 @@ import ( "context" "encoding/hex" "fmt" - "html" - "html/template" "net/url" "os" "path/filepath" @@ -422,16 +420,6 @@ func (u *User) GetDisplayName() string { return u.Name } -func (u *User) GetSearchNameHTML() template.HTML { - if setting.UI.DefaultShowFullName { - trimmed := strings.TrimSpace(u.FullName) - if len(trimmed) > 0 { - return template.HTML(fmt.Sprintf(`%s %s`, html.EscapeString(u.Name), html.EscapeString(trimmed))) - } - } - return template.HTML(html.EscapeString(u.Name)) -} - func gitSafeName(name string) string { return strings.TrimSpace(strings.NewReplacer("\n", "", "<", "", ">", "").Replace(name)) } diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index f21611c6348dd..e61f749c3ecec 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -826,6 +826,8 @@ func CompareDiff(ctx *context.Context) { ctx.Data["AllowMaintainerEdit"] = false } + ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName + ctx.HTML(http.StatusOK, tplCompare) } diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 3715320f10c84..b13e3a3cccc83 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -455,6 +455,7 @@ func Issues(ctx *context.Context) { } ctx.Data["CanWriteIssuesOrPulls"] = ctx.Repo.CanWriteIssuesOrPulls(isPullList) + ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplIssues) } @@ -906,6 +907,7 @@ func NewIssue(ctx *context.Context) { } ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWrite(unit.TypeIssues) + ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplIssueNew) } @@ -1834,6 +1836,7 @@ func ViewIssue(ctx *context.Context) { ctx.Data["IsRepoAdmin"] = ctx.IsSigned && (ctx.Repo.IsAdmin() || ctx.Doer.IsAdmin) ctx.Data["LockReasons"] = setting.Repository.Issue.LockReasons ctx.Data["RefEndName"] = git.RefEndName(issue.Ref) + ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName var hiddenCommentTypes *big.Int if ctx.IsSigned { diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go index d712df1001bc3..c12ba7f341d06 100644 --- a/routers/web/repo/milestone.go +++ b/routers/web/repo/milestone.go @@ -293,6 +293,7 @@ func MilestoneIssuesAndPulls(ctx *context.Context) { ctx.Data["CanWriteIssues"] = ctx.Repo.CanWriteIssuesOrPulls(false) ctx.Data["CanWritePulls"] = ctx.Repo.CanWriteIssuesOrPulls(true) + ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplMilestoneIssues) } diff --git a/routers/web/repo/setting_protected_branch.go b/routers/web/repo/setting_protected_branch.go index 34e84c4656827..7017dbbad3fa3 100644 --- a/routers/web/repo/setting_protected_branch.go +++ b/routers/web/repo/setting_protected_branch.go @@ -152,6 +152,7 @@ func SettingsProtectedBranch(c *context.Context) { } c.Data["Rule"] = rule + c.Data["IsShowFullName"] = setting.UI.DefaultShowFullName c.HTML(http.StatusOK, tplProtectedBranch) } diff --git a/routers/web/repo/tag.go b/routers/web/repo/tag.go index 95bc6dfce7f80..4bf2fcb93089b 100644 --- a/routers/web/repo/tag.go +++ b/routers/web/repo/tag.go @@ -24,6 +24,7 @@ func Tags(ctx *context.Context) { if setTagsContext(ctx) != nil { return } + ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplTags) } diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 001cebc331c36..7b4487d8b9750 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -134,7 +134,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}}{{.GetSearchNameHTML}} + {{avatar $.Context .}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName "IsShowFullName" $.IsShowFullName}} {{end}} @@ -154,7 +154,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context .}}{{.GetSearchNameHTML}} + {{avatar $.Context .}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName "IsShowFullName" $.IsShowFullName}} {{end}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index 261d35fe295b7..f372d051a25bc 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -77,7 +77,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}}{{.GetSearchNameHTML}} + {{avatar $.Context .}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName "IsShowFullName" $.IsShowFullName}} {{end}} @@ -97,7 +97,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context . 28 "gt-mr-2"}}{{.GetSearchNameHTML}} + {{avatar $.Context . 28 "gt-mr-2"}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName "IsShowFullName" $.IsShowFullName}} {{end}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 0d198d337d68e..fc84427f9ccc6 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -186,7 +186,7 @@ - {{avatar $.Context . 28 "gt-mr-3"}}{{.GetSearchNameHTML}} + {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName "IsShowFullName" $.IsShowFullName}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 997d13f94daee..eb6fc10655416 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -26,7 +26,7 @@ {{svg "octicon-check"}} - {{avatar $.Context .User 28 "gt-mr-3"}}{{.User.GetSearchNameHTML}} + {{avatar $.Context .User 28 "gt-mr-3"}}{{template "repo/search_name" Dict "Name" .User.Name "FullName" .User.FullName "IsShowFullName" $.IsShowFullName}} {{end}} @@ -257,7 +257,7 @@ {{end}} {{svg "octicon-check"}} - {{avatar $.Context . 28 "gt-mr-3"}}{{.GetSearchNameHTML}} + {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName "IsShowFullName" $.IsShowFullName}} {{end}} diff --git a/templates/repo/search_name.tmpl b/templates/repo/search_name.tmpl new file mode 100644 index 0000000000000..7a48de640c2d2 --- /dev/null +++ b/templates/repo/search_name.tmpl @@ -0,0 +1 @@ +{{.Name}}{{if .IsShowFullName}} {{.FullName}}{{end}} \ No newline at end of file diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index 66479e34330e2..c101a746d411e 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -49,7 +49,7 @@ @@ -100,7 +100,7 @@ @@ -179,7 +179,7 @@ diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl index 417ce0d17ebcb..c188e66697bf2 100644 --- a/templates/repo/settings/tags.tmpl +++ b/templates/repo/settings/tags.tmpl @@ -36,7 +36,7 @@ From ab4f1e130f2cdc34feb30d7b1b5b872fd2ac41d5 Mon Sep 17 00:00:00 2001 From: HesterG Date: Wed, 15 Mar 2023 13:30:22 +0800 Subject: [PATCH 19/21] new line --- templates/repo/search_name.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/search_name.tmpl b/templates/repo/search_name.tmpl index 7a48de640c2d2..c5faebf89523d 100644 --- a/templates/repo/search_name.tmpl +++ b/templates/repo/search_name.tmpl @@ -1 +1 @@ -{{.Name}}{{if .IsShowFullName}} {{.FullName}}{{end}} \ No newline at end of file +{{.Name}}{{if .IsShowFullName}} {{.FullName}}{{end}} From 7e03788e1e7cc216f13e5cfb4f6e49d74b055fea Mon Sep 17 00:00:00 2001 From: HesterG Date: Wed, 15 Mar 2023 13:40:34 +0800 Subject: [PATCH 20/21] define DefaultShowFullName inhelper.go --- modules/templates/helper.go | 3 +++ routers/web/repo/compare.go | 2 -- routers/web/repo/issue.go | 3 --- routers/web/repo/milestone.go | 1 - routers/web/repo/setting_protected_branch.go | 1 - routers/web/repo/tag.go | 1 - templates/repo/issue/list.tmpl | 4 ++-- templates/repo/issue/milestone_issues.tmpl | 4 ++-- templates/repo/issue/new_form.tmpl | 2 +- templates/repo/issue/view_content/sidebar.tmpl | 4 ++-- templates/repo/search_name.tmpl | 2 +- templates/repo/settings/protected_branch.tmpl | 6 +++--- templates/repo/settings/tags.tmpl | 2 +- 13 files changed, 15 insertions(+), 20 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 822bbbd9b17c4..a8343428dc19b 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -109,6 +109,9 @@ func NewFuncMap() []template.FuncMap { "CustomEmojis": func() map[string]string { return setting.UI.CustomEmojisMap }, + "IsShowFullName": func() bool { + return setting.UI.DefaultShowFullName + }, "Safe": Safe, "SafeJS": SafeJS, "JSEscape": JSEscape, diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index e61f749c3ecec..f21611c6348dd 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -826,8 +826,6 @@ func CompareDiff(ctx *context.Context) { ctx.Data["AllowMaintainerEdit"] = false } - ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName - ctx.HTML(http.StatusOK, tplCompare) } diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index b13e3a3cccc83..3715320f10c84 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -455,7 +455,6 @@ func Issues(ctx *context.Context) { } ctx.Data["CanWriteIssuesOrPulls"] = ctx.Repo.CanWriteIssuesOrPulls(isPullList) - ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplIssues) } @@ -907,7 +906,6 @@ func NewIssue(ctx *context.Context) { } ctx.Data["HasIssuesOrPullsWritePermission"] = ctx.Repo.CanWrite(unit.TypeIssues) - ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplIssueNew) } @@ -1836,7 +1834,6 @@ func ViewIssue(ctx *context.Context) { ctx.Data["IsRepoAdmin"] = ctx.IsSigned && (ctx.Repo.IsAdmin() || ctx.Doer.IsAdmin) ctx.Data["LockReasons"] = setting.Repository.Issue.LockReasons ctx.Data["RefEndName"] = git.RefEndName(issue.Ref) - ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName var hiddenCommentTypes *big.Int if ctx.IsSigned { diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go index c12ba7f341d06..d712df1001bc3 100644 --- a/routers/web/repo/milestone.go +++ b/routers/web/repo/milestone.go @@ -293,7 +293,6 @@ func MilestoneIssuesAndPulls(ctx *context.Context) { ctx.Data["CanWriteIssues"] = ctx.Repo.CanWriteIssuesOrPulls(false) ctx.Data["CanWritePulls"] = ctx.Repo.CanWriteIssuesOrPulls(true) - ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplMilestoneIssues) } diff --git a/routers/web/repo/setting_protected_branch.go b/routers/web/repo/setting_protected_branch.go index 7017dbbad3fa3..34e84c4656827 100644 --- a/routers/web/repo/setting_protected_branch.go +++ b/routers/web/repo/setting_protected_branch.go @@ -152,7 +152,6 @@ func SettingsProtectedBranch(c *context.Context) { } c.Data["Rule"] = rule - c.Data["IsShowFullName"] = setting.UI.DefaultShowFullName c.HTML(http.StatusOK, tplProtectedBranch) } diff --git a/routers/web/repo/tag.go b/routers/web/repo/tag.go index 4bf2fcb93089b..95bc6dfce7f80 100644 --- a/routers/web/repo/tag.go +++ b/routers/web/repo/tag.go @@ -24,7 +24,6 @@ func Tags(ctx *context.Context) { if setTagsContext(ctx) != nil { return } - ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName ctx.HTML(http.StatusOK, tplTags) } diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 7b4487d8b9750..7f0ed7d29a6ff 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -134,7 +134,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName "IsShowFullName" $.IsShowFullName}} + {{avatar $.Context .}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName}} {{end}} @@ -154,7 +154,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context .}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName "IsShowFullName" $.IsShowFullName}} + {{avatar $.Context .}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName}} {{end}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index f372d051a25bc..c7f8e910561ca 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -77,7 +77,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName "IsShowFullName" $.IsShowFullName}} + {{avatar $.Context .}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName}} {{end}} @@ -97,7 +97,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context . 28 "gt-mr-2"}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName "IsShowFullName" $.IsShowFullName}} + {{avatar $.Context . 28 "gt-mr-2"}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName}} {{end}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index fc84427f9ccc6..34c2d1a471458 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -186,7 +186,7 @@ - {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName "IsShowFullName" $.IsShowFullName}} + {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index eb6fc10655416..474fd6adc3714 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -26,7 +26,7 @@ {{svg "octicon-check"}} - {{avatar $.Context .User 28 "gt-mr-3"}}{{template "repo/search_name" Dict "Name" .User.Name "FullName" .User.FullName "IsShowFullName" $.IsShowFullName}} + {{avatar $.Context .User 28 "gt-mr-3"}}{{template "repo/search_name" Dict "Name" .User.Name "FullName" .User.FullName}} {{end}} @@ -257,7 +257,7 @@ {{end}} {{svg "octicon-check"}} - {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName "IsShowFullName" $.IsShowFullName}} + {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName}} {{end}} diff --git a/templates/repo/search_name.tmpl b/templates/repo/search_name.tmpl index c5faebf89523d..468f6c394cd83 100644 --- a/templates/repo/search_name.tmpl +++ b/templates/repo/search_name.tmpl @@ -1 +1 @@ -{{.Name}}{{if .IsShowFullName}} {{.FullName}}{{end}} +{{.Name}}{{if IsShowFullName}} {{.FullName}}{{end}} diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index c101a746d411e..deb59ba879787 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -49,7 +49,7 @@ @@ -100,7 +100,7 @@ @@ -179,7 +179,7 @@ diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl index c188e66697bf2..57e8ba0b75d94 100644 --- a/templates/repo/settings/tags.tmpl +++ b/templates/repo/settings/tags.tmpl @@ -36,7 +36,7 @@ From b34193f11c7d641cad64b25190478303d12850cd Mon Sep 17 00:00:00 2001 From: HesterG Date: Wed, 15 Mar 2023 14:40:24 +0800 Subject: [PATCH 21/21] change params passed to template --- templates/repo/issue/list.tmpl | 4 ++-- templates/repo/issue/milestone_issues.tmpl | 4 ++-- templates/repo/issue/new_form.tmpl | 2 +- templates/repo/issue/view_content/sidebar.tmpl | 4 ++-- templates/repo/settings/protected_branch.tmpl | 6 +++--- templates/repo/settings/tags.tmpl | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 7f0ed7d29a6ff..975d659470926 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -134,7 +134,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName}} + {{avatar $.Context .}}{{template "repo/search_name" .}} {{end}} @@ -154,7 +154,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context .}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName}} + {{avatar $.Context .}}{{template "repo/search_name" .}} {{end}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index c7f8e910561ca..cb20fb0c568e2 100644 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -77,7 +77,7 @@ {{.locale.Tr "repo.issues.filter_poster_no_select"}} {{range .Posters}} - {{avatar $.Context .}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName}} + {{avatar $.Context .}}{{template "repo/search_name" .}} {{end}} @@ -97,7 +97,7 @@ {{.locale.Tr "repo.issues.filter_assginee_no_select"}} {{range .Assignees}} - {{avatar $.Context . 28 "gt-mr-2"}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName}} + {{avatar $.Context . 28 "gt-mr-2"}}{{template "repo/search_name" .}} {{end}} diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 34c2d1a471458..b45a00f781403 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -186,7 +186,7 @@ - {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName}} + {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" .}} {{end}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 474fd6adc3714..40d87b41785b8 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -26,7 +26,7 @@ {{svg "octicon-check"}} - {{avatar $.Context .User 28 "gt-mr-3"}}{{template "repo/search_name" Dict "Name" .User.Name "FullName" .User.FullName}} + {{avatar $.Context .User 28 "gt-mr-3"}}{{template "repo/search_name" .User}} {{end}} @@ -257,7 +257,7 @@ {{end}} {{svg "octicon-check"}} - {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" Dict "Name" .Name "FullName" .FullName}} + {{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" .}} {{end}} diff --git a/templates/repo/settings/protected_branch.tmpl b/templates/repo/settings/protected_branch.tmpl index deb59ba879787..d63fed46bcc52 100644 --- a/templates/repo/settings/protected_branch.tmpl +++ b/templates/repo/settings/protected_branch.tmpl @@ -49,7 +49,7 @@ @@ -100,7 +100,7 @@ @@ -179,7 +179,7 @@ diff --git a/templates/repo/settings/tags.tmpl b/templates/repo/settings/tags.tmpl index 57e8ba0b75d94..aa23c6a57d9ad 100644 --- a/templates/repo/settings/tags.tmpl +++ b/templates/repo/settings/tags.tmpl @@ -36,7 +36,7 @@