diff --git a/command/pullrequest/gitlab.go b/command/pullrequest/gitlab.go index 17d844e2..d9cfab86 100644 --- a/command/pullrequest/gitlab.go +++ b/command/pullrequest/gitlab.go @@ -1,16 +1,15 @@ package pullrequest import ( - "regexp" - "strings" - "text/template" - "github.com/innogames/slack-bot/v2/bot" "github.com/innogames/slack-bot/v2/bot/config" "github.com/innogames/slack-bot/v2/bot/matcher" "github.com/pkg/errors" log "github.com/sirupsen/logrus" - "github.com/xanzy/go-gitlab" + "gitlab.com/gitlab-org/api/client-go" + "regexp" + "strings" + "text/template" ) type gitlabFetcher struct { @@ -63,11 +62,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": + var 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 }