Originally asked by Peter Hochstrasser on 14 September 2019 (original question)
Hi
You have excellent documentation on how to take over and cleanup comments in various ways:
- impersonate comments, or rather, add a header to the comment that mimicks the original comment lead in:
" added a comment on -"
- remove @mentions in bodies to avoid unnecessary notifications
- merging new and existing comments
Now, I’d like to combine these three, such that the final comment body has:
- the original author,
- the updated date,
- no @mentions, but the displayNames of the users who have been mentioned.
All this is for an intra-instance JIRA Server sync, so, all usernames are available in both JIRA projects.
Answer by Francis Martens (Exalate) on 14 September 2019
Challenge accepted
The sanitization needs to be done when composing the message and sending it to the other side>
Add the code snippet from sanitize_mentions.groovy to the outgoing sync of the connection (and remove the standard replica.comments = issue.comments)
The formatting of the comment body on the receiving side can be done with following snippet (available here)
When the user directory on both ends are identical - like in your case, you can include the mention sanitization on the destination end - example snippet here