mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
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:
3 files changed
+31
-3
No files matched your search
@@ -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"`
|
||||
|
||||
Reference in new issue
Block a user