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

fix(#95): bad request error when use filter-by-assignee together with… #108

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion internal/issues/jql_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ func BuildSearchIssuesJql(project *jira.Project, query string, status *jira.Issu
jql = jql + fmt.Sprintf(" AND status=%s", status.Id)
}
if user != nil && user.DisplayName != ui.MessageAll {
jql = jql + fmt.Sprintf(" AND assignee=%s", user.AccountId)
userId := user.AccountId
if userId == "" {
userId = user.Name
}
jql = jql + fmt.Sprintf(" AND assignee=%s", userId)
}
// TODO - would be safer to check the index of inserted all message, instead of checking it like this / same for all All checks
if label != "" && label != ui.MessageAll {
Expand Down
1 change: 1 addition & 0 deletions internal/issues/jql_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func Test_buildSearchIssuesJql(t *testing.T) {
"project=123 AND summary~\"abc*\" AND status=st1 AND assignee=us1 ORDER BY status",
},
{"should create valid jql", args{project: &jira.Project{Id: "123"}, label: "test"}, "project=123 AND labels=test ORDER BY status"},
{"should create valid jql", args{project: &jira.Project{Id: "123"}, user: &jira.User{Name: "bob"}}, "project=123 AND assignee=bob ORDER BY status"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
Loading