mattermost-plugin-jira
mattermost-plugin-jira copied to clipboard
Jira's autolink should support issue links that contain a comment link in the URL
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.
Here's an example provided by an admin that works with comments:
{
"DisableNonWordPrefix": false,
"DisableNonWordSuffix": false,
"Disabled": false,
"Name": "jirajumptocomment",
"Pattern": "https://something.atlassian.net/browse/(?P\u003cIssueKey\u003e[A-Za-z]+-[0-9]+)[?]focusedCommentId[^\\s]+",
"Scope": null,
"Template": "[${IssueKey} Link to comment]($0)",
"WordMatch": false
}
Discussed in https://community-daily.mattermost.com/private-core/pl/fkeoiwqbmbyrxrqnap877jykbo
Hi @mickmister , I'd like to work on this. Can you help me on getting started? and I think I can't open the link discussion.
@vicky-demansol There's really no helpful context in the linked conversation. Take a look at how Autolink is currently used in this project, and see how this can be added.
Normally we fetch all Jira projects, then create an Autolink entry for each project, but notice how the regex in the issue description does not contain the Jira project. The regex instead captures the project in the IssueKey submatch. This is especially useful because we then don't need to fetch the projects. This will also make it so we can support Autolinks for Jira Server instead of just Jira Cloud.
@vicky-demansol Completing this ticket would solve a lot of problems at once. If we apply the same logic of regex to regular issue links (along with comment links, i.e. what this ticket is requesting), it will properly solve https://github.com/mattermost/mattermost-plugin-jira/issues/758 properly as well.
This is complete our internal review and awaiting merge of depended PR 213