Questions for Confluence license has expired.

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

How to sync only attachments (images) that are mentioned in description?

 
1
0
-1

We only want to sync images (mentioned in the description) when the sync happens from original to remote how can we achieve that? 


    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Samip K Banker


      Assume  the source is blue and the target  red


      From Source to Target - filter the images


      In the outgoing sync  of the blue, replace the

      replica.attachments = issue.attachments


      with the following statement


      replica.attachments = issue.attachments.findAll { attachment ->
                            attachment.mimetype.startsWith("image/") &&
                            issue.description.contains(attachment.filename)
                        }
      
      



      This will collect all the attachments of type image which are referenced in the issue description into the message sent from source to target





      In the  incoming sync of the red, ensure the following statement is executed

      issue.attachments = attachmentHelper.mergeAttachments(issue, replica)




      From Target to Source - Disable attachment sync by


      In the outgoing sync of the red, remove 

      replica.attachments = issue.attachments


      In the incoming sync of the blue - remove  the 

      issue.attachments  = attachmentHelper.mergeAttachments(issue, replica)



      Let me know

      1. Samip K Banker

        user-50445 :


        I am looking to do somehting similar to this but just for Description... 

        https://docs.idalko.com/exalate/display/ED/How+to+filter+attachments+in+local+comments


        ~Samip

      2. user-3fd1a

        can you elaborate?

        do you want the images referenced in the comments or in the description?

      3. Samip K Banker

        From Description (as the summary of the entry suggest). I looked at the documentation and I can only find how to do what I want to do for Comments... I want to see if you have any example to do it for Description. 

      4. user-3fd1a

        Did you try the suggestion I made in this answer?

        It is exactly that.

      5. Samip K Banker

        Sorry.. I didn't read your feedback proprely yesterday. Thanks. I will try it out.

      CommentAdd your comment...