triage-party icon indicating copy to clipboard operation
triage-party copied to clipboard

issues with multiple assignees

Open durandom opened this issue 2 years ago • 3 comments

An issue/pr with multiple assignees doesn't work with the assigned tag. It will match as !assigned, because it doesn't have a single assignee, but a list of assignees.

Furthermore the As column seems to render only one user, even if there are multiple assigned

image image

durandom avatar Sep 23 '22 07:09 durandom

The following seems to work for !assigned, but not for assigned. 🤷

diff --git a/pkg/hubbub/match.go b/pkg/hubbub/match.go
index ca279eb..7a625f5 100644
--- a/pkg/hubbub/match.go
+++ b/pkg/hubbub/match.go
@@ -95,11 +95,11 @@ func preFetchMatch(i provider.IItem, labels []*provider.Label, fs []provider.Fil
 		// This state can be performed without downloading comments
 		if f.TagRegex() != nil && f.TagRegex().String() == "^assigned$" {
 			// If assigned and no assignee, fail
-			if !f.TagNegate() && i.GetAssignee() == nil {
+			if !f.TagNegate() && len(i.GetAssignees()) == 0 {
 				return false
 			}
 			// if !assigned and has assignee, fail
-			if f.TagNegate() && i.GetAssignee() != nil {
+			if f.TagNegate() && len(i.GetAssignees()) > 0 {
 				return false
 			}
 		}
diff --git a/pkg/provider/issue.go b/pkg/provider/issue.go
index 5095fb5..92cb9f4 100644
--- a/pkg/provider/issue.go
+++ b/pkg/provider/issue.go
@@ -60,6 +60,14 @@ func (i *Issue) GetAssignee() *User {
 	return i.Assignee
 }
 
+// GetAssignees returns the Assignee field.
+func (i *Issue) GetAssignees() []*User {
+	if i == nil {
+		return nil
+	}
+	return i.Assignees
+}
+
 // GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise.
 func (i *Issue) GetAuthorAssociation() string {
 	if i == nil || i.AuthorAssociation == nil {
diff --git a/pkg/provider/item.go b/pkg/provider/item.go
index 41e41ee..73c4459 100644
--- a/pkg/provider/item.go
+++ b/pkg/provider/item.go
@@ -19,6 +19,7 @@ import "time"
 // Item is an interface that matches both Issues and PullRequests
 type IItem interface {
 	GetAssignee() *User
+	GetAssignees() []*User
 	GetAuthorAssociation() string
 	GetBody() string
 	GetComments() int
diff --git a/pkg/provider/pull_request.go b/pkg/provider/pull_request.go
index f6bbea4..0688bc6 100644
--- a/pkg/provider/pull_request.go
+++ b/pkg/provider/pull_request.go
@@ -84,6 +84,14 @@ func (p *PullRequest) GetAssignee() *User {
 	return p.Assignee
 }
 
+// GetAssignee returns the Assignee field.
+func (p *PullRequest) GetAssignees() []*User {
+	if p == nil {
+		return nil
+	}
+	return p.Assignees
+}
+
 // GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise.
 func (p *PullRequest) GetAuthorAssociation() string {
 	if p == nil || p.AuthorAssociation == nil {

durandom avatar Sep 23 '22 08:09 durandom

If you can give me some directions in #292 I'm happy to continue trying to fix it

durandom avatar Sep 23 '22 08:09 durandom

I'm facing the same issue, and the fixes in this PR work fine for me. Is there anyone who can review it?

hrk091 avatar Sep 27 '23 07:09 hrk091