Note

We've packed up and moved from Confluence to Discourse to bring you a better, more interactive space. Out of courtesy we didn't migrate your user account so - you will have to signup again

The Exalate team will be on holiday for the coming days - returning Jan 4
Enjoy & stay safe

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction


Exalate can be used to synchronize the user mentions in Comments between Jira and Azure DevOps.

...

Code Block
languagegroovy
titleADO Outgoing Sync
linenumberstrue
collapsetrue
replica.description    = workItem.description
def allComments = workItem.comments.collect {
    comment ->
def comment1=comment.body
def matcher  = comment1 =~ /(?<=data-vss-mention="version:2.0,).*?(?=\")/
matcher.each {
 x->
 
def userId=nodeHelper.getUser(x,"ProjectDemo_keyExalate")?.email
 if (userId)
{
def matcher1 = comment1 =~ /<a[^>]*?data-vss-mention="version:2.0,${x}[^"]*?"[^>]*?>.*?<\/a>/
 
matcher1.each{
    y->
    comment1=comment1.replaceAll(y,"[~accountid:"+userId+"]")
  }
 
}
           
}
 
    comment.body=comment1
    comment
}
replica.comments       = nodeHelper.stripHtmlFromComments(allComments)


Here is the high level notes:

...

Code Block
languagegroovy
titleIncoming Sync Jira Cloud
linenumberstrue
collapsetrue
issue.description  = nodeHelper.toMarkDownFromHtml(replica.description)
for(comment in replica.addedComments){
    def newCommentBody=comment.body
    def matcher  = comment.body =~ /\[~accountid:([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)\]/
 matcher.each {
 x->
    def target = nodeHelper.getUserByEmail(x[1])?.key ?:x[1]
    newCommentBody = newCommentBody.replace(x[1],target)
}
 comment.body=  newCommentBody
}
 
def addedCommentsissue.comments     = nodeHelper.toMarkDownComments(commentHelper.mergeComments(issue, replica))


Here is the high level notes:

...

Code Block
languagegroovy
titleJira Cloud Outgoing Sync
linenumberstrue
collapsetrue
Stringreplica.description start1="#exalate_comment#"
String end1="#exalate_comment_end#"= nodeHelper.getHtmlField(issue, "description")
def html_comments = nodeHelper.getHtmlComments(issue)
def regex = /<a\s+(?:[^>]*?\s+)?accountid=["']([^"']+)["'].*?>(.*?)<\/a>/
replica.comments = issue.html_comments.collect {
comment ->
      
    def matcher  input= comment.body =~ /\[~accountid:([\w:-]+)\]/
    def newCommentBodyresult = comment.body
      input.replaceAll(regex) { match, accountId, anchorText ->
    matcher.each {
     targetdef userInfo = nodeHelper.getUser(it[1]accountId)?.email ?: "Stranger" 
    def replacement = "#exalate_comment# ${userInfo} #exalate_comment_end#"
    
 target   = start1+target+end1
     newCommentBody = newCommentBody.replace(it[0],target)
    }
  
// You can modify the counter usage or tracking logic here if necessary
    return replacement
}
    comment.body = newCommentBodyresult
    comment
}


Here is the high level notes:

...

Code Block
languagegroovy
titleAzure Incoming
linenumberstrue
collapsetrue
workItem.description  = replica.description
String start1="#exalate_comment#"
String end1="#exalate_comment_end#"
for(comment in replica.addedComments)
{
  
  def matcher  = comment.body =~ /(?<=#exalate_comment#).*?(?=#exalate_comment_end#)/
  
 matcher.each {
 x->
   def userId=nodeHelper.getUserByEmail(x.trim(),"ProjectDemo_keyExalate")?.key
   if(userId){
     def string = "<a href=\"#\" data-vss-mention=\"version:2.0,"+userId+"\"></a>"
     def test = comment.body.replaceAll(start1+ x + end1,string)
     comment.body = test
   }
    }
 }
}
workItem.comments     = commentHelper.mergeComments(workItem, replica)

...

Widget Connector
urlhttp://youtube.com/watch?v=31kO_ARJgSs

Questions

Questions List
filterrecent
asktrue
include-topicsany
spaceexacom

...