-
Notifications
You must be signed in to change notification settings - Fork 127
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
[mm 699] - Reporter should receive DM when someone comments on their issue Fixes #699 #810
Conversation
Hello @sibasankarnayak, Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here. |
Codecov Report
@@ Coverage Diff @@
## master #810 +/- ##
==========================================
- Coverage 34.81% 34.79% -0.03%
==========================================
Files 52 52
Lines 5949 6059 +110
==========================================
+ Hits 2071 2108 +37
- Misses 3666 3733 +67
- Partials 212 218 +6
Continue to review full report at Codecov.
|
@sibasankarnayak Please link the ticket this PR fixes uses the |
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
@levb @mickmister can you review this |
Yes, I will review the PR soon. Thanks for pinging us. @sibasankarnayak FYI, by quoting the full comment above you've pinged other people that don't need to be pinged in this case. Especially when the quoted comment gets several levels deep, this can be an issue. Just be careful who you are pinging in your comments, and make sure it's only the people you want to communicate with. Thanks again for the ping to review 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality LGTM, just one request to make sure we don't send duplicate notifications
@aaronrothschild Do you think the reporter should get a notification for when the issue is updated, or only when someone comments on the issue? |
Personally, I like getting notified when it is updated, but 0/5 |
@mickmister Can you review this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @sibasankarnayak! I have some requests, the main one being that we should introduce the new notification settings as *bool
in order to be backwards compatible with their current preferences. Please see the following comments for context:
go.mod
Outdated
@@ -18,5 +18,5 @@ require ( | |||
github.com/rudderlabs/analytics-go v3.3.1+incompatible | |||
github.com/stretchr/testify v1.7.0 | |||
github.com/trivago/tgo v1.0.7 // indirect | |||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d | |||
golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in this file and go.sum
seem unrelated to the purpose of this PR. Can you please revert these changes?
server/webhook.go
Outdated
recipientTypeAssignee = "assignee" | ||
recipientTypeReporter = "reporter" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these values used?
server/webhook_parser.go
Outdated
@@ -304,6 +304,7 @@ func appendCommentNotifications(wh *webhook, verb string) { | |||
message: fmt.Sprintf("%s **commented** on %s:\n>%s", commentAuthor, jwh.mdKeySummaryLink(), jwh.Comment.Body), | |||
postType: PostTypeComment, | |||
commentSelf: jwh.Comment.Self, | |||
recipientType: recipientTypeAssignee, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this field is never used, let's not introduce it in the PR
|
||
if _, _, err = wh.PostNotifications(ww.p, msg.InstanceID); err != nil { | ||
ww.p.errorf("WebhookWorker id: %d, error posting notifications, err: %v", ww.id, err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this would be a separate issue
server/command_test.go
Outdated
commandArgs: &model.CommandArgs{Command: "/jira settings notifications assignee on", UserId: mockUserIDWithoutNotifications}, | ||
numInstances: 1, | ||
expectedMsg: "Settings updated. Notifications on.", | ||
expectedMsg: "Settings updated.\n\tAssignee on.", | ||
}, | ||
"disable notifications": { | ||
commandArgs: &model.CommandArgs{Command: "/jira settings notifications off", UserId: mockUserIDWithNotifications}, | ||
commandArgs: &model.CommandArgs{Command: "/jira settings notifications assignee off", UserId: mockUserIDWithNotifications}, | ||
numInstances: 1, | ||
expectedMsg: "Settings updated. Notifications off.", | ||
expectedMsg: "Settings updated.\n\tAssignee off.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add tests for the new fields as well? So there would be tests for assignee, mention, and reporter. Please let me know your thoughts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
@sibasankarnayak Heads up that there are conflicts to resolve |
@hanzei Done , resolved conflict |
@levb @mickmister Gentle reminder to review this PR |
server/user.go
Outdated
@@ -43,15 +43,35 @@ func (c *Connection) JiraAccountID() types.ID { | |||
} | |||
|
|||
type ConnectionSettings struct { | |||
Notifications bool `json:"notifications"` | |||
Notifications *bool `json:"notifications"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why pointer values? what is the difference of a nil
and a false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@levb this was a suggestion from @mickmister #705 (comment)
it seems to keep a track where the user have explicitly turned off the notification and users are still using the previous configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@levb We're using pointers for backwards compatibility, so we can fall back on the user's current settings if these are nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not change the semantics of the keys so that the desired default false, "DisableXXXNotifications"? Then no need for crash-prone pointers?
Also, I am not sure of the user value of having 3 separate settings, seems like a single setting is sufficient... @aaronrothschild |
@levb Some of the notification types are noisier than others. Maybe a given user doesn't want watcher notifications because that's too many notifications. Note that the watcher notifications is introduced in another open PR, but the principle is the same. cc @aaronrothschild |
Some of the notification types are noisier than others. Maybe a given user doesn't want watcher So if we factor in the new reporter notifications and watcher notifications, we have a total of 4 reasons why someone might get a notification:
The question is if these should all be configured with one user setting
|
@mickmister made the changes as discussed over call , Please review and share the feedback. |
Since there is a lot of overlap with this PR and #840, I'm holding off on reviewing the current changes in this PR. @sibasankarnayak What would you like to do here? Are you wanting to merge one PR before the other, or close one of the PRs? |
I would like to be merge this PR and then can continue on the #840 . |
@mickmister share you comments on this. |
@sibasankarnayak Sure. Many of my comments on #840 apply to this PR as well. Would you like me to create the same comments on this PR? |
@mickmister should we take the other PR to close both the issue as the code in this PR is still there in other PR ? |
@sibasankarnayak So you're implying we should close this PR in favor of the other PR? I'm fine with that if this is what you're suggesting |
@mickmister yes i mean that , will be closing this and continue working on the other PR to close reporter and watching notification |
This PR modifies appendCommentNotifications so both Assignee and Reporter will get a notification when someone comments on their issue (previously, only Assignee gets the notification)
ticket here
Fixes #699