diff --git a/command/pullrequest/gitlab.go b/command/pullrequest/gitlab.go index 17d844e2..4089bc9e 100644 --- a/command/pullrequest/gitlab.go +++ b/command/pullrequest/gitlab.go @@ -63,11 +63,17 @@ func (c *gitlabFetcher) getPullRequest(match matcher.Result) (pullRequest, error func (c *gitlabFetcher) getStatus(pr *gitlab.MergeRequest) prStatus { // https://docs.gitlab.com/ce/api/merge_requests.html - switch pr.State { - case "merged": + inReview := false + if len(pr.Reviewers) > 0 { + inReview = true + } + switch { + case pr.State == "merged": return prStatusMerged - case "closed", "locked": + case pr.State == "closed" || pr.State == "locked": return prStatusClosed + case inReview: + return prStatusInReview default: return prStatusOpen } diff --git a/command/pullrequest/gitlab_test.go b/command/pullrequest/gitlab_test.go index a9f59fee..6d82cd57 100644 --- a/command/pullrequest/gitlab_test.go +++ b/command/pullrequest/gitlab_test.go @@ -51,6 +51,15 @@ func TestGitlab(t *testing.T) { mr.State = "closed" actual = gitlabFetcher.getStatus(mr) assert.Equal(t, prStatusClosed, actual) + + mr = &gitlab.MergeRequest{} + mr.Reviewers = []*gitlab.BasicUser{ + { + Username: "user", + }, + } + actual = gitlabFetcher.getStatus(mr) + assert.Equal(t, prStatusInReview, actual) }) t.Run("test convertToPullRequest", func(t *testing.T) {