fix(issue): show merged pull requests as merged in issue lists and search

issue list --kind all, milestone issue list and search pr reported a
merged pull request as closed. Their state is now merged, in tables and
in JSON, which also tells issues and pull requests apart by kind.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-12 00:14:30 +02:00
1 parent 1035ff551b
commit 1749d2f7f6
3 files changed
+31 -3

No files matched your search

+11 -2
View File
@@ -39,16 +39,25 @@ const (
KindPull = "pull"
)
// discussionFrom converts an issue or a pull request listed among issues.
// discussionFrom converts an issue or a pull request listed among issues; the state of a merged
// pull request is "merged" rather than "closed".
func discussionFrom(issue *gitea.Issue) Issue {
item := issueFrom(issue)
item.Kind = KindIssue
item.Kind, item.State = KindIssue, discussionState(issue)
if issue.PullRequest != nil {
item.Kind = KindPull
}
return item
}
// discussionState is the state of an issue, or "merged" for a merged pull request.
func discussionState(issue *gitea.Issue) string {
if issue.PullRequest != nil && issue.PullRequest.HasMerged {
return "merged"
}
return string(issue.State)
}
// IssueMilestone identifies the milestone associated with an issue or pull request.
type IssueMilestone struct {
ID int64 `json:"id"`