From fab18ed4a95266530c4fa539460699b367c73522 Mon Sep 17 00:00:00 2001 From: rista404 Date: Sat, 25 Apr 2020 22:57:03 +0200 Subject: [PATCH 1/2] Show awaiting triage when project col is empty --- command/issue.go | 6 +++++- command/pr.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/command/issue.go b/command/issue.go index 2f4e145af..f2cb4ba47 100644 --- a/command/issue.go +++ b/command/issue.go @@ -504,7 +504,11 @@ func issueProjectList(issue api.Issue) string { projectNames := make([]string, 0, len(issue.ProjectCards.Nodes)) for _, project := range issue.ProjectCards.Nodes { - projectNames = append(projectNames, fmt.Sprintf("%s (%s)", project.Project.Name, project.Column.Name)) + colName := project.Column.Name + if colName == "" { + colName = "Awaiting triage" + } + projectNames = append(projectNames, fmt.Sprintf("%s (%s)", project.Project.Name, colName)) } list := strings.Join(projectNames, ", ") diff --git a/command/pr.go b/command/pr.go index a5b1f0079..009548061 100644 --- a/command/pr.go +++ b/command/pr.go @@ -417,7 +417,11 @@ func prProjectList(pr api.PullRequest) string { projectNames := make([]string, 0, len(pr.ProjectCards.Nodes)) for _, project := range pr.ProjectCards.Nodes { - projectNames = append(projectNames, fmt.Sprintf("%s (%s)", project.Project.Name, project.Column.Name)) + colName := project.Column.Name + if colName == "" { + colName = "Awaiting triage" + } + projectNames = append(projectNames, fmt.Sprintf("%s (%s)", project.Project.Name, colName)) } list := strings.Join(projectNames, ", ") From a2a6036c6543973a4940a905263e87c63d742dc1 Mon Sep 17 00:00:00 2001 From: rista404 Date: Sat, 25 Apr 2020 23:12:51 +0200 Subject: [PATCH 2/2] Add tests --- command/issue_test.go | 2 +- command/pr_test.go | 2 +- test/fixtures/issueView_previewWithMetadata.json | 8 ++++++++ test/fixtures/prViewPreviewWithMetadataByNumber.json | 8 ++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/command/issue_test.go b/command/issue_test.go index b7f91031d..e9229ac24 100644 --- a/command/issue_test.go +++ b/command/issue_test.go @@ -312,7 +312,7 @@ func TestIssueView_Preview(t *testing.T) { `Open • marseilles opened about 292 years ago • 9 comments`, `Assignees: marseilles, monaco\n`, `Labels: one, two, three, four, five\n`, - `Projects: Project 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\)\n`, + `Projects: Project 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\), Project 4 \(Awaiting triage\)\n`, `Milestone: uluru\n`, `bold story`, `View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`, diff --git a/command/pr_test.go b/command/pr_test.go index 074420deb..ba0989645 100644 --- a/command/pr_test.go +++ b/command/pr_test.go @@ -429,7 +429,7 @@ func TestPRView_Preview(t *testing.T) { `Open • nobody wants to merge 12 commits into master from blueberries`, `Assignees: marseilles, monaco\n`, `Labels: one, two, three, four, five\n`, - `Projects: Project 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\)\n`, + `Projects: Project 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\), Project 4 \(Awaiting triage\)\n`, `Milestone: uluru\n`, `blueberries taste good`, `View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12\n`, diff --git a/test/fixtures/issueView_previewWithMetadata.json b/test/fixtures/issueView_previewWithMetadata.json index a420eec66..246bbd77b 100644 --- a/test/fixtures/issueView_previewWithMetadata.json +++ b/test/fixtures/issueView_previewWithMetadata.json @@ -67,6 +67,14 @@ "column": { "name": "column C" } + }, + { + "project": { + "name": "Project 4" + }, + "column": { + "name": "" + } } ], "totalcount": 3 diff --git a/test/fixtures/prViewPreviewWithMetadataByNumber.json b/test/fixtures/prViewPreviewWithMetadataByNumber.json index de0da816a..e49bcdc85 100644 --- a/test/fixtures/prViewPreviewWithMetadataByNumber.json +++ b/test/fixtures/prViewPreviewWithMetadataByNumber.json @@ -66,6 +66,14 @@ "column": { "name": "column C" } + }, + { + "project": { + "name": "Project 4" + }, + "column": { + "name": "" + } } ], "totalcount": 3