mirror of
https://gitea.com/gitea/tea.git
synced 2026-06-23 03:55:04 +00:00
feat(pulls): show PR URL in detail view (#1036)
Fixes #1035. ## Summary - include the pull request URL in `tea pr <number>` detail output - keep `tea pr create` output to one URL by relying on the shared detail renderer - add a focused regression test ## Tests - `go test ./modules/print` - `go test ./...` --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Leon Müller <mueller4leon@gmail.com> Reviewed-on: https://gitea.com/gitea/tea/pulls/1036 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: LeonM <206012+leonm@noreply.gitea.com> Co-committed-by: LeonM <206012+leonm@noreply.gitea.com>
This commit is contained in:
@@ -73,6 +73,10 @@ func PullDetails(pr *gitea.PullRequest, reviews []*gitea.PullReview, ciStatus *g
|
||||
out += "- Maintainers are allowed to edit\n"
|
||||
}
|
||||
|
||||
if pr.HTMLURL != "" {
|
||||
out = strings.TrimRight(out, "\n") + "\n\n" + pr.HTMLURL + "\n"
|
||||
}
|
||||
|
||||
outputMarkdown(out, getRepoURL(pr.HTMLURL))
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,17 @@ func TestFormatCIStatusAllStates(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPullDetailsIncludesHTMLURL(t *testing.T) {
|
||||
pr := newTestPR(8, "Crm wip")
|
||||
pr.HTMLURL = "https://gitea.example.com/owner/repo/pulls/8"
|
||||
|
||||
out := captureStdout(t, func() {
|
||||
PullDetails(pr, nil, nil)
|
||||
})
|
||||
|
||||
assert.Contains(t, out, pr.HTMLURL)
|
||||
}
|
||||
|
||||
func TestPullsListWithCIField(t *testing.T) {
|
||||
prs := []*gitea.PullRequest{
|
||||
newTestPR(1, "feat: add feature"),
|
||||
|
||||
@@ -88,8 +88,6 @@ func CreatePull(requestCtx stdctx.Context, ctx *context.TeaContext, base, head s
|
||||
|
||||
print.PullDetails(pr, nil, nil)
|
||||
|
||||
fmt.Println(pr.HTMLURL)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user