Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bc113ae
Use first commit title for multi-commit PRs and auto-focus title field
silverwind Feb 12, 2026
9587519
Address review: use explicit commit summary and positive assertion in…
silverwind Feb 12, 2026
4ee4372
Replace initInputAutoFocusEnd with autofocus on issue title input
silverwind Feb 12, 2026
4bd893d
remove js
silverwind Feb 12, 2026
2a4b992
Use IntersectionObserver for issue title auto-focus at end
silverwind Feb 14, 2026
be6a25a
Ensure only the last initInputAutoFocusEnd element gets focus
silverwind Feb 14, 2026
31258e7
Merge branch 'main' into openpr
silverwind Feb 14, 2026
0e3b32d
fix
wxiaoguang Feb 14, 2026
539a081
fixme
wxiaoguang Feb 14, 2026
b74f134
simplify
silverwind Feb 14, 2026
757a06d
fix
wxiaoguang Feb 14, 2026
dfd9b77
fix
wxiaoguang Feb 14, 2026
617ec22
fix test
wxiaoguang Feb 14, 2026
95854f4
fix auto focus bug
wxiaoguang Feb 14, 2026
f32a17d
fix lint
wxiaoguang Feb 14, 2026
cce97d4
fix typo
wxiaoguang Feb 14, 2026
5463405
clarify the commits order
wxiaoguang Feb 14, 2026
9a0b025
replace initInputAutoFocusEnd with native autofocus and data attributes
silverwind Feb 15, 2026
140c407
remove unnecessary focus
silverwind Feb 15, 2026
c8ea7bc
comments
silverwind Feb 15, 2026
0d126d4
simplify data-autofocus-end handler
silverwind Feb 15, 2026
eb97377
use registerGlobalInitFunc and native autofocus per review
silverwind Feb 15, 2026
5b4b0bc
restore js focus
silverwind Feb 15, 2026
36e8a5e
fine tune
wxiaoguang Feb 15, 2026
17ece3a
fine tune
wxiaoguang Feb 15, 2026
77b5203
fix commit message encoding
wxiaoguang Feb 15, 2026
b49cd6d
fix comment
wxiaoguang Feb 15, 2026
a67f4f0
Merge branch 'main' into openpr
silverwind Feb 17, 2026
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
3 changes: 3 additions & 0 deletions routers/web/repo/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,9 @@ func PrepareCompareDiff(
if len(body) > 1 {
ctx.Data["content"] = strings.Join(body[1:], "\n")
}
} else if len(commits) > 1 {
c := commits[len(commits)-1]
title = strings.TrimSpace(c.UserCommit.Summary())
}

if len(title) > 255 {
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 @@ -6,7 +6,7 @@
<div class=" tw-mr-4 not-mobile">{{ctx.AvatarUtils.Avatar .SignedUser 40}}</div>
<div class="ui segment content tw-my-0 avatar-content-left-arrow">
<div class="field">
<input name="title" data-global-init="initInputAutoFocusEnd" id="issue_title" required maxlength="255" autocomplete="off"
<input name="title" data-global-init="initInputAutoFocusEnd" id="issue_title" required maxlength="255" autocomplete="off" autofocus
placeholder="{{ctx.Locale.Tr "repo.milestones.title"}}"
value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}"
>
Expand Down
33 changes: 33 additions & 0 deletions tests/integration/compare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,39 @@ func TestCompareBranches(t *testing.T) {
inspectCompare(t, htmlDoc, diffCount, diffChanges)
}

func TestCompareMultiCommitPRTitle(t *testing.T) {
onGiteaRun(t, func(t *testing.T, u *url.URL) {
user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
repo, err := repo_service.CreateRepositoryDirectly(t.Context(), user1, user1, repo_service.CreateRepoOptions{
Name: "test_multi_commit_pr_title",
Readme: "Default",
AutoInit: true,
DefaultBranch: "main",
}, true)
assert.NoError(t, err)

session := loginUser(t, user1.Name)

// Create a new branch and make two commits with custom summaries
testEditFileToNewBranch(t, session, user1.Name, repo.Name, "main", "multi-commit-branch", "README.md", "first edit\n")
testEditorActionEdit(t, session, user1.Name, repo.Name, "_edit", "multi-commit-branch", "README.md", map[string]string{
Comment thread
silverwind marked this conversation as resolved.
Outdated
"content": "second edit\n",
"commit_choice": "direct",
"commit_summary": "Second commit title",
})

// Open the compare page for creating a PR
req := NewRequest(t, "GET", fmt.Sprintf("/%s/%s/compare/main...multi-commit-branch", user1.Name, repo.Name))
resp := session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)

// The title should be the first (oldest) commit's summary, not the branch name
titleValue := htmlDoc.GetInputValueByName("title")
assert.NotEqual(t, "multi-commit-branch", titleValue, "PR title should not be the branch name for multi-commit PRs")
assert.NotEqual(t, "Second commit title", titleValue, "PR title should not be the latest commit's title")
Comment thread
silverwind marked this conversation as resolved.
Outdated
})
}

func TestCompareCodeExpand(t *testing.T) {
onGiteaRun(t, func(t *testing.T, u *url.URL) {
user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
Expand Down
Loading