mattermost-plugin-jira icon indicating copy to clipboard operation
mattermost-plugin-jira copied to clipboard

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

Open mickmister opened this issue 4 years ago • 4 comments

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

mickmister avatar Jun 21 '21 14:06 mickmister

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.

jupriano avatar Aug 04 '21 08:08 jupriano

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

mickmister avatar Aug 05 '21 14:08 mickmister

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

mickmister avatar Aug 10 '21 06:08 mickmister

This is complete our internal review and awaiting merge of depended PR 213

mkdbns avatar Apr 28 '23 13:04 mkdbns