feat: implement POST /pulls merge handler with merge button in PR detail
Add MergePull HTTP handler that calls the existing client.MergePull()
method, register the POST /pulls/{owner}/{repo}/{index}/merge route,
and add a merge button/form to the PR detail template gated on
Mergeable and open state. Supports merge, rebase, and squash styles.
- Handler returns HTMX fragment on HX-Request, redirect otherwise
- Error path returns inline error fragment for HTMX requests
- Add mock merge endpoint and 3 integration tests
- Merge button only shows when PR is mergeable and open
Closes leeworks-agents/gitea-mobile#229
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,23 @@
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
{{if and .Pull.Mergeable (eq .Pull.State "open")}}
|
||||
<div class="card" style="margin-top:1rem;" id="merge-section">
|
||||
<h2>Merge Pull Request</h2>
|
||||
<form hx-post="/pulls/{{.Pull.RepoOwner}}/{{.Pull.RepoName}}/{{.Pull.Number}}/merge" hx-target="#merge-section" hx-swap="innerHTML">
|
||||
<div class="form-group">
|
||||
<label for="merge-style">Merge Style</label>
|
||||
<select id="merge-style" name="Do">
|
||||
<option value="merge">Merge Commit</option>
|
||||
<option value="rebase">Rebase</option>
|
||||
<option value="squash">Squash</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" style="background-color:var(--accent-purple,#a371f7);">Merge PR</button>
|
||||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<div class="card" style="margin-top:1rem;">
|
||||
<h2>Submit Review</h2>
|
||||
<form hx-post="/pulls/{{.Pull.RepoOwner}}/{{.Pull.RepoName}}/{{.Pull.Number}}/review" hx-swap="outerHTML">
|
||||
|
||||
Reference in New Issue
Block a user