Hi,
I want to share the workaround I have develop for this bug.
I discovered that if the linked file is also linked in another comment without alias, the links with alias works.
With that info, I have created a Script Runner Listener on comment creation and comment edition of Service Desk projects.
If a public comment is created or edited, and that comment contains file links with alias, the script cretes a new comment only with the linked files, but this time without alias:
import com.atlassian.jira.bc.issue.comment.property.CommentPropertyService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.issue.comments.Comment
import groovy.json.JsonSlurper
import java.util.regex.*
final SD_PUBLIC_COMMENT = "sd.public.comment"
def event = event as IssueEvent
def user = event.getUser()
def comment = event.getComment()
def commentPropertyService = ComponentAccessor.getComponent(CommentPropertyService)
def isInternal = { Comment c ->
def commentProperty = commentPropertyService.getProperty(user, c.id, SD_PUBLIC_COMMENT)
.getEntityProperty().getOrNull()
if (commentProperty) {
def props = new JsonSlurper().parseText(commentProperty.getValue())
props['internal'].toBoolean()
} else {
null
}
}
if (comment && !isInternal(comment)) {
String txt = comment.getBody()
def files = []
Pattern filepat = Pattern.compile("\\[.*\\|\\^(.*)\\]")
Matcher m = filepat.matcher(txt)
while (m.find()) {
files << "[^"+m.group(1)+"]"
}
if(files){
def commentManager = ComponentAccessor.getCommentManager()
commentManager.create(issue, comment.getAuthor(), files.join("\n"), false)
}
}
This way, the original alias link works ok.
I hope this may help.
Regards.
Hi,
I want to share the workaround I have develop for this bug.
I discovered that if the linked file is also linked in another comment without alias, the links with alias works.
With that info, I have created a Script Runner Listener on comment creation and comment edition of Service Desk projects.
If a public comment is created or edited, and that comment contains file links with alias, the script cretes a new comment only with the linked files, but this time without alias:
This way, the original alias link works ok.
I hope this may help.
Regards.