Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues with multiple assignees #291

Open
durandom opened this issue Sep 23, 2022 · 3 comments · May be fixed by #292
Open

issues with multiple assignees #291

durandom opened this issue Sep 23, 2022 · 3 comments · May be fixed by #292

Comments

@durandom
Copy link

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
Copy link
Author

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 durandom linked a pull request Sep 23, 2022 that will close this issue
@durandom
Copy link
Author

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

@hrk091
Copy link

hrk091 commented Sep 27, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants