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

[GH-773]: Fixed Issue Jira's autolink should support issue links that contain a comment link in the URL #871

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Kshitij-Katiyar
Copy link
Contributor

@Kshitij-Katiyar Kshitij-Katiyar commented Sep 21, 2022

Summary

  • Currently the autolink config used by this plugin converts issue links to shorthand links, but it does not work when the originally posted URL has a comment link at the end of the posted URL. Fixed this issue updated the pattern for focusedCommentId as well.
  • This PR contains all the changes from Pr #839. So this PR alone is enough to fix this issue so we can close Pr #839 afterward.

Issue

#2)

* [MI-2119]: Jira's autolink should issue links that contain a comment link in the URL

* [MI-2119]: Review fixes
1. Chnaged the name of few variables

* [MI-2119]:Review fixes
1. Changed the name of a variable
@mattermod
Copy link
Contributor

Hello @Kshitij-Katiyar,

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.

@javaguirre javaguirre self-requested a review September 29, 2022 08:07
Copy link
Contributor

@javaguirre javaguirre left a comment

Choose a reason for hiding this comment

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

Let me know when you can review this!

* [MI-2119]: Jira's autolink should issue links that contain a comment link in the URL

* [MI-2119]: Review fixes
1. Chnaged the name of few variables

* [MI-2119]:Review fixes
1. Changed the name of a variable

* [MI-2199]: Review fixes done
1. Added constants

* [MI-2199]:Review fixes
1. Added constants properly

* [MI-2119]: Review fixes done
1. Changed the name of the variable

* [MI-2119]: Review fixes done
1.Improved code quality

* [MI-2119]:Review Fixes
1. Changed the name of variable
@Kshitij-Katiyar Kshitij-Katiyar requested review from javaguirre and removed request for mickmister September 30, 2022 10:07
Copy link
Contributor

@javaguirre javaguirre left a comment

Choose a reason for hiding this comment

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

Thank you very much for the effort!

@javaguirre
Copy link
Contributor

Could you post a video on how to use this new change? Something like this so it's easier to QA.

#863 (comment)

Thank you!

@Nityanand13
Copy link
Contributor

Nityanand13 commented Oct 5, 2022

Could you post a video on how to use this new change? Something like this so it's easier to QA.

#863 (comment)

Thank you!

Vedio link for this PR:
https://drive.google.com/file/d/1ucoAzdEsrFd5L5Pw5W5XQPyw-6BVdCY_/view?usp=sharing

@javaguirre
Copy link
Contributor

Can't see the video, could you please check if you can upload a compatible format with Drive? Thank you @Nityanand13 !

@Nityanand13
Copy link
Contributor

Nityanand13 commented Oct 6, 2022

Can't see the video, could you please check if you can upload a compatible format with Drive? Thank you @Nityanand13 !

Vedio link for this PR:
Fixed_Issue_Jira_autolink_should_support_issue_links_that_contain_a_comment_link_in_the_URL.webm

I think now it should be visible

@javaguirre javaguirre added the 3: QA Review Requires review by a QA tester label Oct 11, 2022
@mickmister
Copy link
Contributor

@Kshitij-Katiyar I'm thinking we should have tests in the autolink repo to test these regex changes, like mattermost-community/mattermost-plugin-autolink#189. Please let me know your thoughts on this 👍

@Nityanand13
Copy link
Contributor

Nityanand13 commented Oct 18, 2022

@Kshitij-Katiyar I'm thinking we should have tests in the autolink repo to test these regex changes, like mattermost/mattermost-plugin-autolink#189. Please let me know your thoughts on this +1

@mickmister Test cases for these regex changes have already been written and it is even merged in the master as well. You can look at here: #L121. And there is no any changes in regex after that

@mickmister
Copy link
Contributor

Thanks @Nityanand13! Do you know the behavior of backwards compatibility for this feature? If I have existing autolinks present from previous versions of the Jira plugin, what is the result when I upgrade the plugin? Do I have any duplicate autolink entries?

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

@Nityanand13
Copy link
Contributor

Thanks @Nityanand13! Do you know the behavior of backwards compatibility for this feature? If I have existing autolinks present from previous versions of the Jira plugin, what is the result when I upgrade the plugin? Do I have any duplicate autolink entries?

If I have an existing autolink present from the previous versions of the Jira plugin and when I upgrade the plugin with this feature then it is not working. To see this feature, we should remove the mattermost-autolink field from config.json of the mattermost server and restart the server after upgrading the plugin with the new autolink regex.

@hanzei hanzei requested a review from mickmister November 29, 2022 14:11
@hanzei hanzei added 2: Dev Review Requires review by a core committer and removed Lifecycle/1:stale labels Nov 29, 2022
@mickmister
Copy link
Contributor

If I have an existing autolink present from the previous versions of the Jira plugin and when I upgrade the plugin with this feature then it is not working. To see this feature, we should remove the mattermost-autolink field from config.json of the mattermost server and restart the server after upgrading the plugin with the new autolink regex.

@Nityanand13 The feature needs to be backwards compatible if possible. If there are breaking changes, we need to be clear with release notes about what the admin needs to do manually to have the plugin operating as intended. We'll also need to release the plugin as a new major version 4.0.0.

@mickmister
Copy link
Contributor

@Nityanand13 What is the behavior if the admin does not remove the entries from config.json?

@Nityanand13
Copy link
Contributor

Nityanand13 commented Dec 2, 2022

@Nityanand13 What is the behavior if the admin does not remove the entries from config.json?

@mickmister In the mattermost-autolink field inside config.json, we have the links field which is the array of objects that contains the information about the link that is supported like the template, pattern, scope, etc. When I upgrade the plugin with this feature then the information about the new types of links gets appended at the last of this array. And now if publish a comment link in the mattermost, then its pattern gets matched with the pattern of the issue link present earlier in the array while the pattern of the comment link is at the last of the array.
And when we remove the mattermost-autolink field from config.json and restart the server then that array gets modified such that the information about the comment link comes first.

@mickmister
Copy link
Contributor

mickmister commented Dec 6, 2022

@Nityanand13 So in the case of not removing the entries in config.json (we should assume that the admin is not going to do remove them), do the autolinks function properly?

And now if publish a comment link in the mattermost, then its pattern gets matched with the pattern of the issue link present earlier in the array while the pattern of the comment link is at the last of the array.

As long as the link operations are done correctly in both cases, it's fine to have both in the config. Other than general housekeeping, is there a reason why the admin would want to remove the existing autolinks?

Also mentioned this here mattermost-community/mattermost-plugin-autolink#189 (comment)

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

@Nityanand13
Copy link
Contributor

Nityanand13 commented Dec 19, 2022

@Nityanand13 So in the case of not removing the entries in config.json (we should assume that the admin is not going to do remove them), do the autolinks function properly?

And now if publish a comment link in the mattermost, then its pattern gets matched with the pattern of the issue link present earlier in the array while the pattern of the comment link is at the last of the array.

As long as the link operations are done correctly in both cases, it's fine to have both in the config. Other than general housekeeping, is there a reason why the admin would want to remove the existing autolinks?

Also mentioned this here mattermost/mattermost-plugin-autolink#189 (comment)

@mickmister In case we are not removing the mattermost-autolink field from config.json and restarting the server, then autolink functions properly for issue links but not for issue links containing a comment link in the URL. To make sure that autolink functions properly for the issue links containing a comment link as well, we should remove the mattermost-autolink field from config.json and restart the server.

@mickmister
Copy link
Contributor

To make sure that autolink functions properly for the issue links containing a comment link as well, we should remove the mattermost-autolink field from config.json and restart the server.

@Nityanand13 This is not an option for Mattermost Cloud instances. We'll need to automate this somehow. Maybe the Autolink plugin needs to support an endpoint to delete them or something. There's also complications with HA and multiple instances of the plugin attempting these operations simultaneously. @hanzei @levb What do you think about this issue?

@hanzei
Copy link
Collaborator

hanzei commented Feb 3, 2023

If the autolink plugin would support a propper CRUD methods in its client, the JIRA plugin could fix the link issues programmatically. Maybe it's worth updating the autolink plugin, prepackaging the new version and then updating the links programmatically via JIRA.

@hanzei
Copy link
Collaborator

hanzei commented Feb 22, 2023

Opened mattermost-community/mattermost-plugin-autolink#207 for Brightscout

@hanzei hanzei added Do Not Merge/Awaiting PR Awaiting another pull request before merging (e.g. server changes) Lifecycle/frozen and removed 2: Dev Review Requires review by a core committer Lifecycle/1:stale 3: QA Review Requires review by a QA tester labels Feb 22, 2023
@codecov-commenter
Copy link

codecov-commenter commented Feb 22, 2023

Codecov Report

Attention: Patch coverage is 0% with 21 lines in your changes are missing coverage. Please review.

Project coverage is 31.22%. Comparing base (f986c15) to head (df69291).
Report is 98 commits behind head on master.

❗ Current head df69291 differs from pull request most recent head c0eb515. Consider uploading reports for the commit c0eb515 to get more accurate results

Files Patch % Lines
server/plugin.go 0.00% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #871      +/-   ##
==========================================
- Coverage   31.46%   31.22%   -0.24%     
==========================================
  Files          49       49              
  Lines        5982     6027      +45     
==========================================
  Hits         1882     1882              
- Misses       3911     3956      +45     
  Partials      189      189              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Kshitij-Katiyar and others added 5 commits April 7, 2023 16:41
Copy link
Member

@wiggin77 wiggin77 left a comment

Choose a reason for hiding this comment

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

Let me know when this is ready - I'm removing from my queue for now.

@raghavaggarwal2308 raghavaggarwal2308 added this to the v4.3.0 milestone Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contributor Do Not Merge/Awaiting PR Awaiting another pull request before merging (e.g. server changes) Lifecycle/frozen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jira's autolink should support issue links that contain a comment link in the URL