enhance(ui): align the work-in-progress merge box with GitHub (#40594)

The work-in-progress state of a pull request now uses GitHub's wording:
"Draft pull requests cannot be merged.", "Ready for review", "Still in
progress? Convert to draft" and "marked the pull request as draft".

The tooltip of the blocked merge button opens below the button, so it no
longer covers the explanation. The merge style trigger takes the
disabled look of the merge button and stays usable, as on GitHub.

Before:

<img width="600" alt="Before"
src="https://github.com/user-attachments/assets/f0720a8c-d870-45e0-9ebb-9b355a3f414d">

After:

<img width="600" alt="After"
src="https://github.com/user-attachments/assets/4abfe57e-de93-4933-9717-6e533ae801c4">

Ref: https://github.com/go-gitea/gitea/issues/40588

Assisted-by: OpenAI Codex:GPT-5
Assisted-by: Claude Code:claude-fable-5-2

---------

Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
Jing Luandsilverwind authored and GitHub committed 2026-12-03 20:24:29 +00:00
1 parent 0e4d804b89
commit a21860f90e
7 files changed
+23 -10

No files matched your search

+5 -5
View File
@@ -1781,7 +1781,7 @@
"repo.pulls.title_desc": "wants to merge %[1]d commits from <code>%[2]s</code> into <code id=\"branch_target\">%[3]s</code>",
"repo.pulls.merged_title_desc": "merged %[1]d commits from <code>%[2]s</code> into <code>%[3]s</code> %[4]s",
"repo.pulls.change_target_branch_at": "changed target branch from <b>%s</b> to <b>%s</b> %s",
"repo.pulls.marked_as_work_in_progress_at": "marked the pull request as work in progress %s",
"repo.pulls.marked_as_work_in_progress_at": "marked the pull request as draft %s",
"repo.pulls.marked_as_ready_for_review_at": "marked the pull request as ready for review %s",
"repo.pulls.tab_conversation": "Conversation",
"repo.pulls.tab_commits": "Commits",
@@ -1799,9 +1799,8 @@
"repo.pulls.is_closed": "The pull request has been closed.",
"repo.pulls.title_wip_desc": "<a href=\"#\">Start the title with <strong>%s</strong></a> to prevent the pull request from being merged accidentally.",
"repo.pulls.cannot_merge_work_in_progress": "This pull request is still a work in progress",
"repo.pulls.still_in_progress": "Still in progress?",
"repo.pulls.add_prefix": "Add <strong>%s</strong> prefix",
"repo.pulls.remove_prefix": "Remove <strong>%s</strong> prefix",
"repo.pulls.convert_to_draft": "Still in progress? Convert to draft",
"repo.pulls.ready_for_review": "Ready for review",
"repo.pulls.data_broken": "This pull request is broken due to missing fork information.",
"repo.pulls.files_conflicted": "This branch has conflicts that must be resolved",
"repo.pulls.is_checking": "Checking for the ability to merge automatically…",
@@ -1810,6 +1809,7 @@
"repo.pulls.is_empty": "The changes on this branch are already on the target branch. This will be an empty commit.",
"repo.pulls.is_unrelated": "This branch has no history in common with the target branch.",
"repo.pulls.merging_is_blocked": "Merging is blocked",
"repo.pulls.merging_is_blocked_desc": "Merging is blocked due to failing merge requirements",
"repo.pulls.review_required": "Review required",
"repo.pulls.changes_approved": "Changes approved",
"repo.pulls.approvals_granted_1": "%d approving review by reviewers with write access.",
@@ -1842,7 +1842,7 @@
"repo.pulls.wrong_commit_id": "commit ID must be a commit ID on the target branch",
"repo.pulls.no_merge_desc": "This pull request cannot be merged because all repository merge options are disabled.",
"repo.pulls.no_merge_helper": "Enable merge options in the repository settings or merge the pull request manually.",
"repo.pulls.no_merge_wip": "This pull request cannot be merged because it is marked as being a work in progress.",
"repo.pulls.no_merge_wip": "Draft pull requests cannot be merged.",
"repo.pulls.no_merge_not_ready": "This pull request is not ready to be merged. Check review status and status checks.",
"repo.pulls.no_merge_access": "You are not authorized to merge this pull request.",
"repo.pulls.merge_pull_request": "Create merge commit",
+1 -1
View File
@@ -170,7 +170,7 @@ func (prInfo *pullRequestViewInfo) prepareMergeBoxFormProps(ctx *context.Context
"textMergeCommitId": ctx.Locale.Tr("repo.pulls.merge_commit_id"),
"textSelectMergeStyle": ctx.Locale.Tr("repo.pulls.select_merge_style"),
"textMergeTitle": ctx.Locale.Tr("form.CommitMessage"),
"textMergeBlocked": ctx.Locale.Tr("repo.pulls.merging_is_blocked"),
"textMergeBlocked": ctx.Locale.Tr("repo.pulls.merging_is_blocked_desc"),
"isMergeStateClean": data.IsMergeStateClean,
"canMergeNow": canMergeNow,
+1 -1
View File
@@ -1,5 +1,5 @@
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed) (not .IsPullWorkInProgress)}}
<button type="button" class="interact-fg" data-global-init="initPullRequestWipToggle" data-title="{{.Issue.Title}}" data-wip-prefix="{{index .PullRequestWorkInProgressPrefixes 0}}" data-update-url="{{.Issue.Link}}/title">
{{ctx.Locale.Tr "repo.pulls.still_in_progress"}} {{ctx.Locale.Tr "repo.pulls.add_prefix" (index .PullRequestWorkInProgressPrefixes 0)}}
{{ctx.Locale.Tr "repo.pulls.convert_to_draft"}}
</button>
{{end}}
@@ -39,7 +39,7 @@
{{template "repo/issue/view_content/pull_merge_section" (dict "MergeBoxSection" $mergeBoxData.WorkInProgressSection)}}
{{if or $.HasIssuesOrPullsWritePermission $.IsIssuePoster}}
<button type="button" class="ui button tw-shrink-0" data-global-init="initPullRequestWipToggle" data-title="{{$issue.Title}}" data-wip-prefix="{{$.WorkInProgressPrefix}}" data-update-url="{{$issue.Link}}/title">
{{ctx.Locale.Tr "repo.pulls.remove_prefix" $.WorkInProgressPrefix}}
{{ctx.Locale.Tr "repo.pulls.ready_for_review"}}
</button>
{{end}}
</div>
+9
View File
@@ -62,6 +62,15 @@ test('outdated branch can be rebased from the update style menu', async ({page,
await assertNoJsError(page);
});
test('work in progress keeps the merge style menu', async ({page}) => {
await page.goto('/devtest/pull-merge-box', {waitUntil: 'commit'});
const mergeBox = page.locator('.pull-merge-box', {hasText: 'This pull request is still a work in progress'});
await mergeBox.getByRole('button', {name: 'Select merge style'}).click();
await page.getByRole('menuitemradio', {name: /^Create squash commit/}).click();
await expect(mergeBox.getByRole('button', {name: 'Create squash commit'})).toBeDisabled();
await assertNoJsError(page);
});
test('branch deleted by a merge can be restored from the timeline', async ({page, request}) => {
const [prLink] = await Promise.all([
apiCreateMergeablePR(request),
+4
View File
@@ -112,6 +112,10 @@
}
}
.merge-box-blocked {
opacity: var(--opacity-disabled);
}
.merge-box-menu .item > .svg {
align-self: flex-start;
margin-top: 2px;
@@ -142,11 +142,11 @@ async function toggleActionForm(show: boolean) {
</form>
<div v-show="!showActionForm" class="flex-text-block tw-flex-wrap">
<div class="ui buttons" :class="mergeButtonStyleClass" :data-tooltip-content="actionDisabled ? mergeForm.textMergeBlocked : undefined">
<div class="ui buttons" :class="mergeButtonStyleClass" :data-tooltip-content="actionDisabled ? mergeForm.textMergeBlocked : undefined" data-tooltip-placement="bottom-start">
<button ref="mergeButton" class="ui button" type="button" :disabled="actionDisabled" @click="toggleActionForm(true)">
{{ buttonTexts.button }}
</button>
<button v-if="mergeForm.mergeStyles.length > 1 && !queue" ref="menuTrigger" class="ui icon button" type="button" :aria-label="mergeForm.textSelectMergeStyle">
<button v-if="mergeForm.mergeStyles.length > 1 && !queue" ref="menuTrigger" class="ui icon button" :class="{'merge-box-blocked': actionDisabled}" type="button" :aria-label="mergeForm.textSelectMergeStyle">
<svg-icon name="octicon-triangle-down" :size="14"/>
</button>
</div>