mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	Fix bug of branch/tag selector in the issue sidebar (#32744)
Fix: #32731 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		| @@ -125,7 +125,10 @@ type Issue struct { | |||||||
| 	IsPull            bool             `xorm:"INDEX"` // Indicates whether is a pull request or not. | 	IsPull            bool             `xorm:"INDEX"` // Indicates whether is a pull request or not. | ||||||
| 	PullRequest       *PullRequest     `xorm:"-"` | 	PullRequest       *PullRequest     `xorm:"-"` | ||||||
| 	NumComments       int | 	NumComments       int | ||||||
|  |  | ||||||
|  | 	// TODO: RemoveIssueRef: see "repo/issue/branch_selector_field.tmpl" | ||||||
| 	Ref string | 	Ref string | ||||||
|  |  | ||||||
| 	PinOrder int `xorm:"DEFAULT 0"` | 	PinOrder int `xorm:"DEFAULT 0"` | ||||||
|  |  | ||||||
| 	DeadlineUnix timeutil.TimeStamp `xorm:"INDEX"` | 	DeadlineUnix timeutil.TimeStamp `xorm:"INDEX"` | ||||||
|   | |||||||
| @@ -1,3 +1,17 @@ | |||||||
|  | {{/* 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. | ||||||
|  |  | ||||||
|  | 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)}} | {{if and (not .Issue.IsPull) (not .PageIsComparePull)}} | ||||||
| <input id="ref_selector" name="ref" type="hidden" value="{{.Reference}}"> | <input id="ref_selector" name="ref" type="hidden" value="{{.Reference}}"> | ||||||
| <div class="ui dropdown select-branch branch-selector-dropdown ellipsis-items-nowrap {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}}" | <div class="ui dropdown select-branch branch-selector-dropdown ellipsis-items-nowrap {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}}" | ||||||
| @@ -29,7 +43,7 @@ | |||||||
| 			{{range .Branches}} | 			{{range .Branches}} | ||||||
| 				<div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector" title="{{.}}">{{.}}</div> | 				<div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector" title="{{.}}">{{.}}</div> | ||||||
| 			{{else}} | 			{{else}} | ||||||
| 				<div class="item">{{ctx.Locale.Tr "no_results_found"}}</div> | 				<div class="item disabled">{{ctx.Locale.Tr "no_results_found"}}</div> | ||||||
| 			{{end}} | 			{{end}} | ||||||
| 		</div> | 		</div> | ||||||
| 		<div id="tag-list" class="scrolling menu reference-list-menu tw-hidden"> | 		<div id="tag-list" class="scrolling menu reference-list-menu tw-hidden"> | ||||||
| @@ -39,7 +53,7 @@ | |||||||
| 			{{range .Tags}} | 			{{range .Tags}} | ||||||
| 				<div class="item" data-id="refs/tags/{{.}}" data-name="tags/{{.}}" data-id-selector="#ref_selector">{{.}}</div> | 				<div class="item" data-id="refs/tags/{{.}}" data-name="tags/{{.}}" data-id-selector="#ref_selector">{{.}}</div> | ||||||
| 			{{else}} | 			{{else}} | ||||||
| 				<div class="item">{{ctx.Locale.Tr "no_results_found"}}</div> | 				<div class="item disabled">{{ctx.Locale.Tr "no_results_found"}}</div> | ||||||
| 			{{end}} | 			{{end}} | ||||||
| 		</div> | 		</div> | ||||||
| 	</div> | 	</div> | ||||||
|   | |||||||
| @@ -47,7 +47,8 @@ | |||||||
| 	</div> | 	</div> | ||||||
|  |  | ||||||
| 	<div class="issue-content-right ui segment"> | 	<div class="issue-content-right ui segment"> | ||||||
| 		{{template "repo/issue/branch_selector_field" $}} | 		{{template "repo/issue/branch_selector_field" $}}{{/* TODO: RemoveIssueRef: template "repo/issue/branch_selector_field" $*/}} | ||||||
|  |  | ||||||
| 		{{if .PageIsComparePull}} | 		{{if .PageIsComparePull}} | ||||||
| 			{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}} | 			{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}} | ||||||
| 			<div class="divider"></div> | 			<div class="divider"></div> | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| <div class="issue-content-right ui segment"> | <div class="issue-content-right ui segment"> | ||||||
| 	{{template "repo/issue/branch_selector_field" $}} | 	{{template "repo/issue/branch_selector_field" $}}{{/* TODO: RemoveIssueRef: template "repo/issue/branch_selector_field" $*/}} | ||||||
|  |  | ||||||
| 	{{if .Issue.IsPull}} | 	{{if .Issue.IsPull}} | ||||||
| 		{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}} | 		{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}} | ||||||
|   | |||||||
| @@ -99,7 +99,7 @@ | |||||||
| 							<span class="gt-ellipsis">{{.Project.Title}}</span> | 							<span class="gt-ellipsis">{{.Project.Title}}</span> | ||||||
| 						</a> | 						</a> | ||||||
| 					{{end}} | 					{{end}} | ||||||
| 					{{if .Ref}} | 					{{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}}> | 						<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}} | 							{{svg "octicon-git-branch" 14}} | ||||||
| 							<span class="gt-ellipsis">{{index $.IssueRefEndNames .ID}}</span> | 							<span class="gt-ellipsis">{{index $.IssueRefEndNames .ID}}</span> | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ import {queryElems, toggleElem} from '../utils/dom.ts'; | |||||||
| import {initIssueSidebarComboList} from './repo-issue-sidebar-combolist.ts'; | import {initIssueSidebarComboList} from './repo-issue-sidebar-combolist.ts'; | ||||||
|  |  | ||||||
| function initBranchSelector() { | function initBranchSelector() { | ||||||
|  |   // TODO: RemoveIssueRef: see "repo/issue/branch_selector_field.tmpl" | ||||||
|   const elSelectBranch = document.querySelector('.ui.dropdown.select-branch'); |   const elSelectBranch = document.querySelector('.ui.dropdown.select-branch'); | ||||||
|   if (!elSelectBranch) return; |   if (!elSelectBranch) return; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user