Skip to content
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

Allow both fullname and username search when DEFAULT_SHOW_FULL_NAME is true #23463

Merged
merged 32 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d9bf9c6
support fullname search
HesterG Mar 10, 2023
79af17f
Merge branch 'go-gitea:main' into fullname-search
HesterG Mar 13, 2023
d7432ce
Merge branch 'go-gitea:main' into fullname-search
HesterG Mar 13, 2023
1a333ac
Merge branch 'go-gitea:main' into fullname-search
HesterG Mar 13, 2023
8a8b4bb
pass ui setting to template
HesterG Mar 13, 2023
15faa66
pass bool
HesterG Mar 13, 2023
7b4f594
update
HesterG Mar 13, 2023
888cd09
remove unnecessary change
HesterG Mar 13, 2023
e99af66
Merge branch 'go-gitea:main' into fullname-search
HesterG Mar 14, 2023
8edc4de
fullname support added to search user related
HesterG Mar 14, 2023
d43597f
add ctx
HesterG Mar 14, 2023
ae41379
Merge branch 'go-gitea:main' into fullname-search
HesterG Mar 14, 2023
61fcdd6
use config to decide if show fullname in search
HesterG Mar 14, 2023
27f57a3
rename isShowFullName to IsShowFullName
HesterG Mar 14, 2023
1e30e66
rename
HesterG Mar 14, 2023
c110521
move inline css to less
HesterG Mar 14, 2023
d581a20
use GetSearchNameHTML instead of passing contexts
HesterG Mar 14, 2023
aded8c1
show fullname only it is not empty
HesterG Mar 14, 2023
b758321
Merge branch 'main' into fullname-search
HesterG Mar 14, 2023
3f8e447
escape strings
HesterG Mar 14, 2023
6ae1968
fix conflict
HesterG Mar 15, 2023
405ac99
Merge branch 'main' into fullname-search
HesterG Mar 15, 2023
c500ce8
add css
HesterG Mar 15, 2023
be58413
new line
HesterG Mar 15, 2023
084a2ac
use template instead of server generate
HesterG Mar 15, 2023
ab4f1e1
new line
HesterG Mar 15, 2023
7e03788
define DefaultShowFullName inhelper.go
HesterG Mar 15, 2023
b34193f
change params passed to template
HesterG Mar 15, 2023
34db52a
Merge branch 'main' into fullname-search
HesterG Mar 15, 2023
0298f42
Merge branch 'main' into fullname-search
HesterG Mar 16, 2023
74b7cdf
Merge branch 'main' into fullname-search
lunny Mar 16, 2023
f3cc545
Merge branch 'main' into fullname-search
jolheiser Mar 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions routers/web/repo/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,8 @@ func CompareDiff(ctx *context.Context) {
ctx.Data["AllowMaintainerEdit"] = false
}

ctx.Data["IsShowFullName"] = setting.UI.DefaultShowFullName

ctx.HTML(http.StatusOK, tplCompare)
}

Expand Down
3 changes: 3 additions & 0 deletions routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions routers/web/repo/milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
1 change: 1 addition & 0 deletions routers/web/repo/setting_protected_branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func SettingsProtectedBranch(c *context.Context) {
}

c.Data["Rule"] = rule
c.Data["IsShowFullName"] = setting.UI.DefaultShowFullName
c.HTML(http.StatusOK, tplProtectedBranch)
}

Expand Down
1 change: 1 addition & 0 deletions routers/web/repo/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions templates/repo/issue/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}">{{.locale.Tr "repo.issues.filter_poster_no_select"}}</a>
{{range .Posters}}
<a class="{{if eq $.PosterID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{.ID}}">
{{avatar $.Context .}} {{.GetDisplayName}}
{{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}<span style="color: var(--color-text-light-2);">{{.FullName}}</span>{{end}}
</a>
{{end}}
</div>
Expand All @@ -154,7 +154,7 @@
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_assginee_no_select"}}</a>
{{range .Assignees}}
<a class="{{if eq $.AssigneeID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{.ID}}&poster={{$.PosterID}}">
{{avatar $.Context .}} {{.GetDisplayName}}
{{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}<span style="color: var(--color-text-light-2);">{{.FullName}}</span>{{end}}
</a>
{{end}}
</div>
Expand Down
9 changes: 7 additions & 2 deletions templates/repo/issue/milestone_issues.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,14 @@
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
</span>
<div class="menu">
<div class="ui icon search input">
<i class="icon gt-df gt-ac gt-jc">{{svg "octicon-search" 16}}</i>
<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_poster"}}">
</div>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&assignee={{$.AssigneeID}}">{{.locale.Tr "repo.issues.filter_poster_no_select"}}</a>
{{range .Posters}}
<a class="{{if eq $.PosterID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&assignee={{$.AssigneeID}}&poster={{.ID}}">
{{avatar $.Context .}} {{.GetDisplayName}}
{{avatar $.Context .}} {{.Name}} {{if $.IsShowFullName}}<span style="color: var(--color-text-light-2);">{{.FullName}}</span>{{end}}
</a>
{{end}}
</div>
Expand All @@ -94,7 +98,8 @@
{{range .Assignees}}
<a class="{{if eq $.AssigneeID .ID}}active selected{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&assignee={{.ID}}&poster={{$.PosterID}}">
{{avatar $.Context . 28 "gt-mr-2"}}
{{.GetDisplayName}}
{{.Name}}
{{if $.IsShowFullName}}<span style="color: var(--color-text-light-2);">{{.FullName}}</span>{{end}}
</a>
{{end}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/issue/new_form.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
<a class="item muted" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}">
<span class="octicon-check invisible">{{svg "octicon-check"}}</span>
<span class="text">
{{avatar $.Context . 28 "gt-mr-3"}}{{.GetDisplayName}}
{{avatar $.Context . 28 "gt-mr-3"}}{{.Name}} {{if $.IsShowFullName}}<span style="color: var(--color-text-light-2);">{{.FullName}}</span>{{end}}
</span>
</a>
{{end}}
Expand Down
6 changes: 4 additions & 2 deletions templates/repo/issue/view_content/sidebar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
<span class="octicon-check {{if not .Checked}}invisible{{end}}">{{svg "octicon-check"}}</span>
<span class="text">
{{avatar $.Context .User 28 "gt-mr-3"}}
{{.User.GetDisplayName}}
{{.User.Name}}
</span>
{{if $.IsShowFullName}}<span class="text" style="color: var(--color-text-light-2);">{{.User.FullName}}</span>{{end}}
techknowlogick marked this conversation as resolved.
Show resolved Hide resolved
</a>
{{end}}
{{end}}
Expand Down Expand Up @@ -259,8 +260,9 @@
<span class="octicon-check {{if not $checked}}invisible{{end}}">{{svg "octicon-check"}}</span>
<span class="text">
{{avatar $.Context . 28 "gt-mr-3"}}
{{.GetDisplayName}}
{{.Name}}
</span>
{{if $.IsShowFullName}}<span class="text" style="color: var(--color-text-light-2);">{{.FullName}}</span>{{end}}
</a>
{{end}}
</div>
Expand Down
6 changes: 3 additions & 3 deletions templates/repo/settings/protected_branch.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
{{range .Users}}
<div class="item" data-value="{{.ID}}">
{{avatar $.Context . 28 "mini"}}
{{.GetDisplayName}}
{{.Name}} {{if $.IsShowFullName}}<span style="color: var(--color-text-light-2);">{{.FullName}}</span>{{end}}
</div>
{{end}}
</div>
Expand Down Expand Up @@ -102,7 +102,7 @@
{{range .Users}}
<div class="item" data-value="{{.ID}}">
{{avatar $.Context . 28 "mini"}}
{{.GetDisplayName}}
{{.Name}} {{if $.IsShowFullName}}<span style="color: var(--color-text-light-2);">{{.FullName}}</span>{{end}}
</div>
{{end}}
</div>
Expand Down Expand Up @@ -182,7 +182,7 @@
{{range .Users}}
<div class="item" data-value="{{.ID}}">
{{avatar $.Context . 28 "mini"}}
{{.GetDisplayName}}
{{.Name}} {{if $.IsShowFullName}}<span style="color: var(--color-text-light-2);">{{.FullName}}</span>{{end}}
</div>
{{end}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/settings/tags.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{{range .Users}}
<div class="item" data-value="{{.ID}}">
{{avatar $.Context . 28 "mini"}}
{{.GetDisplayName}}
{{.Name}} {{if $.IsShowFullName}}<span style="color: var(--color-text-light-2);">{{.FullName}}</span>{{end}}
</div>
{{end}}
</div>
Expand Down