Questions for Confluence license has expired.

Please purchase a new license to continue using Questions for Confluence.

How to only sync public attachments from Jira Service Desk

 
1
0
-1

I want to only sync attachments that are references from public comments

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      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)}
        
          
        CommentAdd your comment...