mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-13 14:42:15 +09:00
Backport #39747 by @AliceLafox * Fixes #39746 * Fixes #35505 The click handlers were bound only to the first `.reference-list-menu` (branches), so clicking a tag did nothing. Bind them to the items of both lists. Co-authored-by: Alisa Lafoks <alice@lafox.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
co-authored by
Alisa Lafoks
wxiaoguang
parent
0132cb82c2
commit
7a03ec3a4c
@@ -81,7 +81,7 @@ type Issue struct {
|
||||
PullRequest *PullRequest `xorm:"-"`
|
||||
NumComments int
|
||||
|
||||
// TODO: RemoveIssueRef: see "repo/issue/branch_selector_field.tmpl"
|
||||
// TODO: ISSUE-SIDEBAR-REF-SELECTOR: see "repo/issue/branch_selector_field.tmpl"
|
||||
Ref string
|
||||
|
||||
PinOrder int `xorm:"-"` // 0 means not loaded, -1 means loaded but not pinned
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
{{/* 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
|
||||
{{/* TODO: ISSUE-SIDEBAR-REF-SELECTOR: Although we proposed to remove the Issue.Ref,
|
||||
> 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,
|
||||
> or sometimes auto-close a ref-matched issue by a commit message when CloseIssuesViaCommitInAnyBranch=false.
|
||||
|
||||
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,
|
||||
or sometimes auto-close a ref-matched issue by a commit message when CloseIssuesViaCommitInAnyBranch=false.
|
||||
|
||||
There are still users using it:
|
||||
* @didim99: it is a really useful feature to specify a branch in which issue found.
|
||||
Actually, there are still enough real users who are interested in it:
|
||||
* @didim99: it is a really useful feature to specify a branch in which issue found (also: https://github.com/go-gitea/gitea/pull/32744)
|
||||
* @AliceLafox: https://github.com/go-gitea/gitea/issues/39746
|
||||
* @mscott-smartuq, @r10r, @@chklemenz, @Smithor, @@JanJurik: https://github.com/go-gitea/gitea/issues/35505
|
||||
* Forum: https://forum.gitea.com/t/alternative-to-github-for-reporting-bugs/11684
|
||||
So we still keep it and mainain it.
|
||||
|
||||
Still needs to figure out:
|
||||
* Could the "recording branch/tag name" be replaced by other approaches?
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
|
||||
<div class="issue-content-right ui segment" data-global-init="initRepoIssueSidebar">
|
||||
{{template "repo/issue/branch_selector_field" $}}{{/* TODO: RemoveIssueRef: template "repo/issue/branch_selector_field" $*/}}
|
||||
{{template "repo/issue/branch_selector_field" $}}
|
||||
|
||||
{{if .PageIsComparePull}}
|
||||
{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="issue-content-right ui segment" data-global-init="initRepoIssueSidebar">
|
||||
{{template "repo/issue/branch_selector_field" $}}{{/* TODO: RemoveIssueRef: template "repo/issue/branch_selector_field" $*/}}
|
||||
{{template "repo/issue/branch_selector_field" $}}
|
||||
|
||||
{{if .Issue.IsPull}}
|
||||
{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}}
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
<span class="gt-ellipsis">{{$project.Title}}</span>
|
||||
</a>
|
||||
{{end}}
|
||||
{{if .Ref}}{{/* TODO: RemoveIssueRef: see "repo/issue/branch_selector_field.tmpl" */}}
|
||||
{{if .Ref}}{{/* TODO: ISSUE-SIDEBAR-REF-SELECTOR: 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>
|
||||
|
||||
@@ -11,12 +11,11 @@ import type {FomanticApiResponse, Issue} from '../types.ts';
|
||||
const {appSubUrl} = window.config;
|
||||
|
||||
function initRepoIssueBranchSelector(elSidebar: HTMLElement) {
|
||||
// TODO: RemoveIssueRef: see "repo/issue/branch_selector_field.tmpl"
|
||||
// TODO: ISSUE-SIDEBAR-REF-SELECTOR: see "repo/issue/branch_selector_field.tmpl"
|
||||
const elSelectBranch = elSidebar.querySelector('.ui.dropdown.select-branch.branch-selector-dropdown');
|
||||
if (!elSelectBranch) return;
|
||||
const urlUpdateIssueRef = elSelectBranch.getAttribute('data-url-update-issueref');
|
||||
const elBranchMenu = elSelectBranch.querySelector('.reference-list-menu')!;
|
||||
queryElems(elBranchMenu, '.item:not(.no-select)', (el) => el.addEventListener('click', async function (e) {
|
||||
queryElems(elSelectBranch, '.reference-list-menu .item:not(.no-select)', (el) => el.addEventListener('click', async function (e) {
|
||||
e.preventDefault();
|
||||
const selectedValue = this.getAttribute('data-id')!; // eg: "refs/heads/my-branch"
|
||||
const selectedText = this.getAttribute('data-name'); // eg: "my-branch"
|
||||
|
||||
Reference in New Issue
Block a user