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

[mm 699] - Reporter should receive DM when someone comments on their issue Fixes #699 #810

Closed
wants to merge 30 commits into from

Conversation

sibasankarnayak
Copy link
Contributor

@sibasankarnayak sibasankarnayak commented Sep 29, 2021

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

@mattermod
Copy link
Contributor

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.

@sibasankarnayak sibasankarnayak changed the title added notification for reporters if present [mm 699] - Reporter should receive DM when someone comments on their issue fixes #699 Sep 29, 2021
@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2021

Codecov Report

Merging #810 (9f1e96f) into master (c6a6f00) will decrease coverage by 0.02%.
The diff coverage is 47.46%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
server/command.go 17.84% <0.00%> (-0.29%) ⬇️
server/subscribe.go 66.85% <ø> (ø)
server/user_cloud.go 0.00% <0.00%> (ø)
server/user_server.go 7.29% <0.00%> (-0.32%) ⬇️
server/utils.go 19.76% <0.00%> (ø)
server/webhook_worker.go 0.00% <0.00%> (ø)
server/webhook.go 29.65% <25.45%> (-2.57%) ⬇️
server/webhook_parser.go 83.33% <78.78%> (-1.90%) ⬇️
server/settings.go 78.04% <91.30%> (-1.96%) ⬇️
server/user.go 29.54% <100.00%> (+3.79%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c6a6f00...9f1e96f. Read the comment docs.

@hanzei hanzei added the Work In Progress Not yet ready for review label Sep 30, 2021
@hanzei
Copy link
Collaborator

hanzei commented Sep 30, 2021

@sibasankarnayak Please link the ticket this PR fixes uses the Fixes #X syntax as described in https://docs.google.com/document/d/1JpTkyjwsdbacV83NXgo8gRA_Zvcjk4DkCRFoiGBUVBs/edit.

@sibasankarnayak sibasankarnayak changed the title [mm 699] - Reporter should receive DM when someone comments on their issue fixes #699 [mm 699] - Reporter should receive DM when someone comments on their issue Fixes #699 Sep 30, 2021
@sibasankarnayak sibasankarnayak changed the title [mm 699] - Reporter should receive DM when someone comments on their issue Fixes #699 [GH 699] - Reporter should receive DM when someone comments on their issue Fixes #699 Sep 30, 2021
@sibasankarnayak sibasankarnayak changed the title [GH 699] - Reporter should receive DM when someone comments on their issue Fixes #699 [mm 699] - Reporter should receive DM when someone comments on their issue Fixes #699 Sep 30, 2021
server/webhook_worker.go Outdated Show resolved Hide resolved
@sibasankarnayak sibasankarnayak removed the Work In Progress Not yet ready for review label Oct 10, 2021
@mickmister mickmister added this to the v3.2.0 milestone Oct 19, 2021
@hanzei hanzei added the 2: Dev Review Requires review by a core committer label Oct 19, 2021
@hanzei hanzei requested a review from levb October 19, 2021 18:07
@hanzei hanzei added the 3: QA Review Requires review by a QA tester label Oct 19, 2021
@mattermod
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

@sibasankarnayak
Copy link
Contributor Author

This PR has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

@levb @mickmister can you review this

@mickmister
Copy link
Contributor

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 👍

Copy link
Contributor

@mickmister mickmister left a 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

server/webhook_worker.go Outdated Show resolved Hide resolved
server/webhook_worker.go Outdated Show resolved Hide resolved
server/webhook_worker.go Outdated Show resolved Hide resolved
server/webhook_worker.go Outdated Show resolved Hide resolved
@mickmister
Copy link
Contributor

@aaronrothschild Do you think the reporter should get a notification for when the issue is updated, or only when someone comments on the issue?

@aaronrothschild
Copy link
Contributor

@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

@sibasankarnayak
Copy link
Contributor Author

@mickmister Can you review this PR

Copy link
Contributor

@mickmister mickmister left a 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:

#705 (comment)

#792 (comment)

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
Copy link
Contributor

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/command.go Outdated Show resolved Hide resolved
server/user.go Outdated Show resolved Hide resolved
Comment on lines 27 to 28
recipientTypeAssignee = "assignee"
recipientTypeReporter = "reporter"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these values used?

@@ -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,
Copy link
Contributor

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)
}
Copy link
Contributor

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/settings.go Outdated Show resolved Hide resolved
Comment on lines 195 to 202
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.",
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@hanzei
Copy link
Collaborator

hanzei commented Mar 1, 2022

@sibasankarnayak Heads up that there are conflicts to resolve

@hanzei hanzei modified the milestones: v3.2.0, v3.3.0 Mar 1, 2022
@sibasankarnayak
Copy link
Contributor Author

@hanzei Done , resolved conflict

@hanzei
Copy link
Collaborator

hanzei commented Mar 1, 2022

@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"`
Copy link
Contributor

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?

Copy link
Contributor Author

@sibasankarnayak sibasankarnayak Mar 3, 2022

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.

Copy link
Contributor

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

Copy link
Contributor

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?

@levb
Copy link
Contributor

levb commented Mar 1, 2022

Also, I am not sure of the user value of having 3 separate settings, seems like a single setting is sufficient... @aaronrothschild

@mickmister
Copy link
Contributor

Also, I am not sure of the user value of having 3 separate settings, seems like a single setting is sufficient

@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

@mickmister
Copy link
Contributor

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.

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:

  • Mentioned
  • Assignee
  • Reporter
  • Watcher

The question is if these should all be configured with one user setting /jira settings notifications, or if they should all be configured, i.e.

  • /jira settings notifications mention true
  • /jira settings notifications assignee true
  • /jira settings notifications reporter true
  • /jira settings notifications watcher true

@sibasankarnayak
Copy link
Contributor Author

@mickmister made the changes as discussed over call , Please review and share the feedback.

@mickmister
Copy link
Contributor

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?

@sibasankarnayak
Copy link
Contributor Author

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 .
Can we do that ?

@sibasankarnayak
Copy link
Contributor Author

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 . Can we do that ?

@mickmister share you comments on this.

@mickmister
Copy link
Contributor

I would like to be merge this PR and then can continue on the #840 . Can we do that ?

@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?

@sibasankarnayak
Copy link
Contributor Author

@mickmister should we take the other PR to close both the issue as the code in this PR is still there in other PR ?

@mickmister
Copy link
Contributor

@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

@sibasankarnayak
Copy link
Contributor Author

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester Contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reporter should receive DM when someone comments on their issue
8 participants