Add open to issues and pull requests in Pluralize#1457
Conversation
mislav
left a comment
There was a problem hiding this comment.
Thanks for taking this on!
I think the issue/PR filtering mechanism should choose to display "open" or not, not the Pluralize helper. Also, we should only ever display "open issues/pull requests" when no filters are passed— otherwise we print a message like "N issues match your search". (The latter logic already exists.)
utils/utils.go
Outdated
| func Pluralize(num int, thing string) string { | ||
| if num == 1 { | ||
| return fmt.Sprintf("%d %s", num, thing) | ||
| isIssueOrPR := thing == "issue" || thing == "pull request" |
There was a problem hiding this comment.
I don't think that the solution belongs in Pluralize, which is a general helper.
The caller of Pluralize should choose what string to pass in as thing. The caller can easily conditionally pass "open pull request" as a word to be pluralized.
There was a problem hiding this comment.
Agreed. I absolutely did not focus on the whether issues or pull requests have filters 🤦
Fixes #1449
Added special conditions for only issues and pull requests to add the word open before them. Rest would behave as it was earlier.