[GH-470] allow users to specify notifications verbosity using a new render-style flag - #534
Conversation
ca92c97 to
6c88096
Compare
Codecov Report
@@ Coverage Diff @@
## master #534 +/- ##
==========================================
+ Coverage 15.51% 15.80% +0.29%
==========================================
Files 15 15
Lines 4151 4201 +50
==========================================
+ Hits 644 664 +20
- Misses 3465 3494 +29
- Partials 42 43 +1
Continue to review full report at Codecov.
|
6c88096 to
8cbf330
Compare
hanzei
left a comment
There was a problem hiding this comment.
Great work 👍
This change will increase the load of the webhook handler a bit as there is additional parsing of the template, but that is fine.
|
Thanks for the review @hanzei! |
|
Your welcome! There was nothing to complain about 😉 |
|
@hanzei |
|
@ijansky Do you mind posting a screenshot of what this feature looks like? |
|
Hi @mickmister @rinkimekari, sorry for the delay, had a busy week. I have tested this locally now and it works - the way to subscribe would be Of course I will add unit tests for the flag enabled as well before merging. Also the "title-only" version could be displayed even more collapsed if you prefer, it's easy to change.
We went for the former approach because it keeps a nice separation of rendering logic and business logic (whole rendering is the responsibility of the template itself), and it makes it easier to add additional configuration options in the future, without having to add if-else statements where the templates are used. It seems there was duplicate work here, since there were 2 opened issues for the same issue. Let me know if you're happy for me to proceed and I'll turn this PR into something merge-worthy asap. Thanks! |
|
@mickmister can you help me with a review when you have the chance? Thank you very much! |
| Hint: "(optional)", | ||
| Item: "--title-only", | ||
| }} | ||
| subscriptionsAdd.AddStaticListArgument("Currently supports --exclude-org-member and --title-only", false, flags) |
There was a problem hiding this comment.
In the state of this PR, we are not able to use both the exclude-org-member and title-only flags simultaneously. This is because they are being treated as a single positional argument, each showing up as a single selectable option in the same argument.
Similar to what was discussed in #505 (comment), we should use "named" arguments with explicit true/false values, rather than using positional arguments that implicitly mean true.
Also, this title-only flag should be available even when config.GitHubOrg is not defined, but it's currently added in this if block which restricts to when config.GitHubOrg is defined.
| actual, err := renderTemplate("newPR", GetEventWithRenderConfig( | ||
| &github.PullRequestEvent{ | ||
| Repo: &repo, | ||
| PullRequest: &pullRequestWithMultipleLabelsAndAssignees, | ||
| Sender: &user, | ||
| }, | ||
| nil, | ||
| )) |
There was a problem hiding this comment.
Can we add tests for all templates that support the title-only flag?
c82a29a to
f5f20e3
Compare
|
Hi @mickmister, I've made several changes to the PR, PTAL again:
|
a0899b1 to
fea4888
Compare
|
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
|
@mickmister ptal, this needs a maintainer approval it seems |
mickmister
left a comment
There was a problem hiding this comment.
LGTM! Just one suggestion to namespace the flag name constants
Thanks @TeodorPt @ijansky @dipak-demansol
| excludeOrgMemberFlag = "exclude-org-member" | ||
| renderStyleFlag = "render-style" | ||
| FeaturesFlag = "features" |
There was a problem hiding this comment.
@TeodorPt What do you think about namespacing the constants like so:
| excludeOrgMemberFlag = "exclude-org-member" | |
| renderStyleFlag = "render-style" | |
| FeaturesFlag = "features" | |
| flagExcludeOrgMember = "exclude-org-member" | |
| flagRenderStyle = "render-style" | |
| flagFeatures = "features" |
|
It's been a while since updating this, been caught up in a lot of other things. I've made the changes and will do a re-test asap and ping you when it's ready (some changes to the documentation were also needed). |
1c38648 to
f3f5c61
Compare
|
@mickmister I finally got around to addressing your comments. I also identified some omissions in the I've forced-pushed due to CI tests timing out (you can check with Compare that no changes were made in the force push). However, the tests are still timing out, do you know why? Thank you! |
|
@DHaussermann After looking at the changes from last QA review from Dipak, there are no significant changes, so I think this is good to merge |
|
/update-branch |
DHaussermann
left a comment
There was a problem hiding this comment.
Tested and passed
- All 3 renders styles work as expected
- Render styles behaves as default when not set
--render-styleshows in subscriptions list when set
LGTM!
Huge thanks @ijansky for this enhancement 🎉
Sorry for the delay on this.
|
@TeodorPt thank you for addressing code review comments. 👍 |
|
This PR has been automatically labelled "stale" because it hasn't had recent activity. |



Summary
This pull request adds a
--render-styleflag to the subscription command to define the notification verbosity of an event rather than the full body as it can be quite lengthy and easily spam a team mattermost channel. It is a shared effort of myself and @TeodorPt and we raised this PR to get early feedback on the direction that this PR takesTicket Link
Fixes #470