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

Fix bug of branch/tag selector in the issue sidebar #32744

Merged
merged 5 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
7 changes: 5 additions & 2 deletions models/issues/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ type Issue struct {
IsPull bool `xorm:"INDEX"` // Indicates whether is a pull request or not.
PullRequest *PullRequest `xorm:"-"`
NumComments int
Ref string
PinOrder int `xorm:"DEFAULT 0"`

// TODO: RemoveIssueRef: see "repo/issue/branch_selector_field.tmpl"
Ref string

PinOrder int `xorm:"DEFAULT 0"`

DeadlineUnix timeutil.TimeStamp `xorm:"INDEX"`

Expand Down
7 changes: 7 additions & 0 deletions templates/repo/issue/branch_selector_field.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{{/* TODO: RemoveIssueRef: the Issue.Ref will be removed in 1.24 or 1.25 if no end user really uses it.
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.
*/}}
{{if and (not .Issue.IsPull) (not .PageIsComparePull)}}
<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}}"
Expand Down
3 changes: 2 additions & 1 deletion templates/repo/issue/new_form.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
</div>

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

{{if .PageIsComparePull}}
{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}}
<div class="divider"></div>
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">
{{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 .Ref}}
{{if and false .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
1 change: 1 addition & 0 deletions web_src/js/features/repo-issue-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {queryElems, toggleElem} from '../utils/dom.ts';
import {initIssueSidebarComboList} from './repo-issue-sidebar-combolist.ts';

function initBranchSelector() {
// TODO: RemoveIssueRef: see "repo/issue/branch_selector_field.tmpl"
const elSelectBranch = document.querySelector('.ui.dropdown.select-branch');
if (!elSelectBranch) return;

Expand Down
Loading