Skip to content

Commit

Permalink
revert the selector and fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Dec 13, 2024
1 parent 1cc889b commit 945ed48
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
19 changes: 13 additions & 6 deletions templates/repo/issue/branch_selector_field.tmpl
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
{{/* TODO: RemoveIssueRef: the Issue.Ref will be removed in 1.24 or 1.25 if no end user really uses it.
{{/* TODO: RemoveIssueRef: the Issue.Ref will be removed in 1.24 or 1.25 if no end user really needs it or there could be better alternative then.
PR: https://github.com/go-gitea/gitea/pull/32744

The Issue.Ref was added by Add possibility to record branch or tag information in an issue (#780)
After 8 years, this "branch selector" does nothing more than saving the branch/tag name into database and displays it.
So there is a plan to remove it:
* Only hide it from the UI in 1.23, and collect feedbacks.
* If nobody complains and explains how to use it, remove code and drop database column in next release.

There are still users using it:
* @didim99: it is a really useful feature to specify a branch in which issue found.

Still needs to figure out:
* Could the "recording branch/tag name" be replaced by other approaches?
* Write the branch name in the issue title/body then it will still be displayed, eg: `[bug] (fix/ui-broken-bug) there is a bug ....`
* Is "GitHub-like development sidebar (`#31899`)" good enough (or better) for your usage?
*/}}
{{if and (not .Issue.IsPull) (not .PageIsComparePull)}}
<input id="ref_selector" name="ref" type="hidden" value="{{.Reference}}">
Expand Down Expand Up @@ -36,7 +43,7 @@ So there is a plan to remove it:
{{range .Branches}}
<div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector" title="{{.}}">{{.}}</div>
{{else}}
<div class="item">{{ctx.Locale.Tr "no_results_found"}}</div>
<div class="item disabled">{{ctx.Locale.Tr "no_results_found"}}</div>
{{end}}
</div>
<div id="tag-list" class="scrolling menu reference-list-menu tw-hidden">
Expand All @@ -46,7 +53,7 @@ So there is a plan to remove it:
{{range .Tags}}
<div class="item" data-id="refs/tags/{{.}}" data-name="tags/{{.}}" data-id-selector="#ref_selector">{{.}}</div>
{{else}}
<div class="item">{{ctx.Locale.Tr "no_results_found"}}</div>
<div class="item disabled">{{ctx.Locale.Tr "no_results_found"}}</div>
{{end}}
</div>
</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 @@ -47,7 +47,7 @@
</div>

<div class="issue-content-right ui segment">
{{/* TODO: RemoveIssueRef: template "repo/issue/branch_selector_field" $*/}}
{{template "repo/issue/branch_selector_field" $}}{{/* TODO: RemoveIssueRef: template "repo/issue/branch_selector_field" $*/}}

{{if .PageIsComparePull}}
{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}}
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/issue/view_content/sidebar.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="issue-content-right ui segment">
{{/* TODO: RemoveIssueRef: template "repo/issue/branch_selector_field" $*/}}
{{template "repo/issue/branch_selector_field" $}}{{/* TODO: RemoveIssueRef: template "repo/issue/branch_selector_field" $*/}}

{{if .Issue.IsPull}}
{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}}
Expand Down
2 changes: 1 addition & 1 deletion templates/shared/issuelist.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<span class="gt-ellipsis">{{.Project.Title}}</span>
</a>
{{end}}
{{if and false .Ref}}{{/* TODO: RemoveIssueRef: see "repo/issue/branch_selector_field.tmpl" */}}
{{if .Ref}}{{/* TODO: RemoveIssueRef: see "repo/issue/branch_selector_field.tmpl" */}}
<a class="ref flex-text-inline tw-max-w-[300px]" {{if $.RepoLink}}href="{{index $.IssueRefURLs .ID}}"{{else}}href="{{.Repo.Link}}{{index $.IssueRefURLs .ID}}"{{end}}>
{{svg "octicon-git-branch" 14}}
<span class="gt-ellipsis">{{index $.IssueRefEndNames .ID}}</span>
Expand Down

0 comments on commit 945ed48

Please sign in to comment.