JIRA SERVERJIRA CLOUD

Introduction

When you synchronize comments, new comments are added using

  • the proxy user as a creator on Jira Server
  • the application user on Jira Cloud

The comment will look like the following:

The Exalate app also provides the ability to impersonate the comment, which means that the comment will be created using the user context of the original author.

 The comment object has a field 'Executor' which can be set to any user. This is how you can impersonate synced comments.

 

Source side

Outgoing sync (data filter)

replica.comments = issue.comments
 


Destination side

You can receive a new comment from the other side and apply it in different ways.

Option 1: assign original comment executor if exists in the local system, create a new user if not found

This option works only for Jira Server


The sequence of steps: 

    • Check if the author of the comment is known locally by doing a user lookup
    • If the author is not known to the local JIRA, create the user
    • Assign the found (or created user) as an executor

 

Incoming sync (create/change processor)

issue.comments = commentHelper.mergeComments(issue, replica, {
  comment ->
  
  def authorUser = userHelper.getByEmail(comment.author.email)
  
  // set the executor, optionally create the user is the local user is not found
  comment.executor = authorUser ?: userHelper.createUser(comment.author.username, 
                                                     "changeme", //password !
                                                     comment.author.email,
                                                     comment.author.displayName
                                                   )
  comment
})

Option 2: assign original comment executor if exists in the local system, use the proxy user if not found

This option works for Jira Server and Jira Cloud

The sequence of steps: 

    • Change the comment executor from the proxy/application user to the original comment author 
    • If the author is not known to the local JIRA, use the proxy user as an author

Incoming sync (create/change processor)

replica.addedComments.each { comment -> comment.executor = comment.author }
  replica.changedComments.each { comment -> comment.executor = comment.updateAuthor }
  issue.comments = commentHelper.mergeComments(issue, replica, {it})

Check user fields sync for more details.



Result

Comment 1 in the picture above has been created by the proxy user, while the second comment has been impersonated.

See Also