google / triage-party

🎉 Triage Party: massively multi-player GitHub triage 🎉
Apache License 2.0
502 stars 80 forks source link

issues with multiple assignees #291

Open durandom opened 1 year ago

durandom commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

hrk091 commented 11 months ago

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