mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-23 19:47:07 +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:
6 files changed
+16
-15
No files matched your search
@@ -81,7 +81,7 @@ type Issue struct {
|
|||||||
PullRequest *PullRequest `xorm:"-"`
|
PullRequest *PullRequest `xorm:"-"`
|
||||||
NumComments int
|
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
|
Ref string
|
||||||
|
|
||||||
PinOrder int `xorm:"-"` // 0 means not loaded, -1 means loaded but not pinned
|
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.
|
{{/* TODO: ISSUE-SIDEBAR-REF-SELECTOR: Although we proposed to remove the Issue.Ref,
|
||||||
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,
|
||||||
|
> 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)
|
Actually, there are still enough real users who are interested in it:
|
||||||
After 8 years, this "branch selector" does nothing more than saving the branch/tag name into database and displays 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)
|
||||||
or sometimes auto-close a ref-matched issue by a commit message when CloseIssuesViaCommitInAnyBranch=false.
|
* @AliceLafox: https://github.com/go-gitea/gitea/issues/39746
|
||||||
|
* @mscott-smartuq, @r10r, @@chklemenz, @Smithor, @@JanJurik: https://github.com/go-gitea/gitea/issues/35505
|
||||||
There are still users using it:
|
* Forum: https://forum.gitea.com/t/alternative-to-github-for-reporting-bugs/11684
|
||||||
* @didim99: it is a really useful feature to specify a branch in which issue found.
|
So we still keep it and mainain it.
|
||||||
|
|
||||||
Still needs to figure out:
|
Still needs to figure out:
|
||||||
* Could the "recording branch/tag name" be replaced by other approaches?
|
* Could the "recording branch/tag name" be replaced by other approaches?
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="issue-content-right ui segment" data-global-init="initRepoIssueSidebar">
|
<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}}
|
{{if .PageIsComparePull}}
|
||||||
{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}}
|
{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div class="issue-content-right ui segment" data-global-init="initRepoIssueSidebar">
|
<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}}
|
{{if .Issue.IsPull}}
|
||||||
{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}}
|
{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@
|
|||||||
<span class="gt-ellipsis">{{$project.Title}}</span>
|
<span class="gt-ellipsis">{{$project.Title}}</span>
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{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}}>
|
<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>
|
||||||
|
|||||||
@@ -11,12 +11,11 @@ import type {FomanticApiResponse, Issue} from '../types.ts';
|
|||||||
const {appSubUrl} = window.config;
|
const {appSubUrl} = window.config;
|
||||||
|
|
||||||
function initRepoIssueBranchSelector(elSidebar: HTMLElement) {
|
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');
|
const elSelectBranch = elSidebar.querySelector('.ui.dropdown.select-branch.branch-selector-dropdown');
|
||||||
if (!elSelectBranch) return;
|
if (!elSelectBranch) return;
|
||||||
const urlUpdateIssueRef = elSelectBranch.getAttribute('data-url-update-issueref');
|
const urlUpdateIssueRef = elSelectBranch.getAttribute('data-url-update-issueref');
|
||||||
const elBranchMenu = elSelectBranch.querySelector('.reference-list-menu')!;
|
queryElems(elSelectBranch, '.reference-list-menu .item:not(.no-select)', (el) => el.addEventListener('click', async function (e) {
|
||||||
queryElems(elBranchMenu, '.item:not(.no-select)', (el) => el.addEventListener('click', async function (e) {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const selectedValue = this.getAttribute('data-id')!; // eg: "refs/heads/my-branch"
|
const selectedValue = this.getAttribute('data-id')!; // eg: "refs/heads/my-branch"
|
||||||
const selectedText = this.getAttribute('data-name'); // eg: "my-branch"
|
const selectedText = this.getAttribute('data-name'); // eg: "my-branch"
|
||||||
|
|||||||
Reference in new issue
Block a user