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

Users mentioned in Jira comment are not receiving DM notifications for Jira 9.2 #954

Closed
mickmister opened this issue Jul 6, 2023 · 12 comments · Fixed by #961
Closed

Users mentioned in Jira comment are not receiving DM notifications for Jira 9.2 #954

mickmister opened this issue Jul 6, 2023 · 12 comments · Fixed by #961

Comments

@mickmister
Copy link
Contributor

A customer has reported that users are not getting DM notifications when they are mentioned in a Jira issue comment. However, the users do get notifications for being assigned to an issue.

From the customer's screenshot, the DM notification posted for assignee does not format the mention in the comment correctly. It shows the user's email like:

I would expect the mention to be formatted using the user's Mattermost username mention instead. This makes me think that something is going on with Jira 9.2 where the mentioned user identifier is not what we expect it to be. It's possible this behavior has changed on Jira's side.

@mickmister
Copy link
Contributor Author

@mkdbns Heads up on this new issue reported by a customer

@raghavaggarwal2308
Copy link
Contributor

@mickmister Are you using a cloud instance or a server instance? Also, can you please send us the MM version?

@mickmister
Copy link
Contributor Author

@raghavaggarwal2308

Jira Server - 9.2.0
Jira plugin - 3.2.5
Mattermost - 7.8.4 I believe but that shouldn't matter as much as the plugin version

@mickmister
Copy link
Contributor Author

@erezo9 I'm curious if this is happening for you as well

@erezo9
Copy link

erezo9 commented Jul 10, 2023

@mickmister ill have to check tommorow, but ye now that you mention it
i dont recieve dms when i get mentined, only mails
ill check my environment tommorw

@Kshitij-Katiyar
Copy link
Contributor

Kshitij-Katiyar commented Jul 25, 2023

@mickmister I am getting the DM notifications when the user is mentioned in a Jira issue comment. I am using the exact setup from the above comment Jira Server - 9.2.0, Jira plugin - 3.2.5, Mattermost - 7.8.4.

Screenshot from 2023-07-25 20-07-29
Now for the second issue, I am able to reproduce the issue where the body is not being formatted properly. This issue is not limited to Jira version 9.2.0 but I have also tested with version 8.22.0 and the issue still persists. I also tried to find the code where we are manipulating the comment body.

func (p *Plugin) replaceJiraAccountIds(instanceID types.ID, body string) string {

In this function, we are replacing the jira account IDs with the jira display name but not with the mattermost userID. Here we are replacing the accountID with the jira display name which we only get from the jira cloud. I can add the same logic for the jira server as well where we are only getting the jira username. Do you want to me parse the comment body and replace them with the mattermost userID for both the jira server and cloud?

@mickmister
Copy link
Contributor Author

Do you want to me parse the comment body and replace them with the mattermost userID for both the jira server and cloud?

@Kshitij-Katiyar Maybe the first issue is occurring on the customer's system and not yours because they have some setting on that uses the user's email in the comment body? Thus making it so the parsing doesn't work currently if it doesn't match the account id. I'm thinking we should try to handle the (seemingly) 3 possible cases:

  • account id
  • username (which is shown in your screenshot)
  • email (which is in this ticket description)

Does this line up with your understanding of the problem? Sorry I feel like I'm guessing here, but I'm mainly going off of the fact that the screenshot in the description is email, and that is what we have available to use I think, and I assume we aren't parsing/translating to MM user id properly.

@Kshitij-Katiyar
Copy link
Contributor

Sure @mickmister I only have 1 small doubt here, Right now if we are getting the account id in the comment body this function

func (p *Plugin) replaceJiraAccountIds(instanceID types.ID, body string) string {

replaces the account IDs with the jira display name whereas in the issue description you have clearly mentioned user's Mattermost username. So should i repalce everything with jira deplay name or Mattermost username?

@mickmister
Copy link
Contributor Author

So should i repalce everything with jira deplay name or Mattermost username?

I'm not sure why that function isn't implemented in a way that uses the MM username. It looks like it is able to do so, though it's showing the Jira user display name instead.

The most important part of this ticket is to fix the "mentions not coming through" issue. I'm wondering if the email is what was originally in the comment payload for the customer, or if that is the "display name" we are putting there from that function. Either way, it seems we are not able to translate the user identifiers in the comment body into MM users to process the DM notifications.

@erezo9 I'm curious if you're able to weigh in on this. You mentioned that DM notifications may not be working on your server, and I'm wondering if the incoming comment payload has the email as the user identifier, as shown in the ticket description.

@mickmister
Copy link
Contributor Author

@Kshitij-Katiyar I meant to mention you in the comment above

@Kshitij-Katiyar
Copy link
Contributor

Kshitij-Katiyar commented Jul 26, 2023

@mickmister I tried updating the jira username with the email address and i stopped getting the dm notifications for the mention because regex we are using to parse the jira usernames from the comment body is not handling the email address. So i think this should be the reason why dm mention notification is not working for that and we can update the regex to handle the email to fix the issue of not getting the notification.

Should i also update the code of function replaceJiraAccountIds to replace them with mattermost username ?

@mickmister
Copy link
Contributor Author

we can update the regex to handle the email to fix the issue of not getting the notification.

@Kshitij-Katiyar Sounds good to me. Thanks for debugging this issue

Should i also update the code of function replaceJiraAccountIds to replace them with mattermost username ?

I'm trying to remember if there's a reason why we had it this way, or if there's a reason why an admin wouldn't want it to have that behavior. I think it's better to have the MM username, so that change sounds good to me.

Kshitij-Katiyar added a commit to Brightscout/mattermost-plugin-jira that referenced this issue Jul 27, 2023
Kshitij-Katiyar added a commit to Brightscout/mattermost-plugin-jira that referenced this issue Jul 27, 2023
Kshitij-Katiyar added a commit to Brightscout/mattermost-plugin-jira that referenced this issue Jul 31, 2023
…rking' (#61)

* [MI-3338]:Fixed issue mattermost#954 'DM comment notifications not working'

* [MI-3338]:Fixed CI
@hanzei hanzei moved this from Todo to Submitted in Brightscout Plugin Maintenance Aug 17, 2023
@hanzei hanzei linked a pull request Aug 17, 2023 that will close this issue
mickmister pushed a commit that referenced this issue Aug 31, 2023
* [MI-3338]:Fixed issue #954 'DM comment notifications not working' (#61)

* [MI-3338]:Fixed issue #954 'DM comment notifications not working'

* [MI-3338]:Fixed CI

* [MI-3337]:Fixed review comment of PR #961 and added TC (#63)

* [MI-3337]:Fixed review comment of PR #961 and added TC

* [MI-3337]:Added EOF

* [MI-3337]:Fixed review comments of #961 (#64)

* [MI-3337]:Fixed review comment of PR #961 and added TC

* [MI-3337]:Added EOF

* [MI-3337]:Fixed review comments of #961
@github-project-automation github-project-automation bot moved this from Submitted to Done in Brightscout Plugin Maintenance Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

4 participants