Originally asked by Juan Grases on 19 May 2020 (original question)
I want to only sync attachments that are references from public comments
Originally asked by Juan Grases on 19 May 2020 (original question)
I want to only sync attachments that are references from public comments
Answer by Juan Grases on 02 June 2020
This block should make it:
def publicComments = issue.comments.findAll{!it.internal}
def isMentionedInPublicComments(attachment, publicComments) {
publicComments.any {c ->
c.body.contains("[^" + attachment.filename + "]") ||
(c.body =~ (/!${java.util.regex.Pattern.quote(attachment.filename)}(\|.*!|!)/.toString())).find()
}
}
replica.attachments = issue.attachments.filter{isMentionedInPublicComments(it, publicComments)}