mergeComments—with custom formatting

    Signature

    Helper
    commentHelper
    Signature
    mergeComments(IHubIssue issue,IHubIssue replica, Closure commentChangeFn)
    Description Allows formatting the comment when merging remote comments. Use a closure to define how the merged comment body should be formatted.
    Introduced 0.10

    Example use

    • Add custom formatting
    // provide a custom format of the comment during update/create of comments
    issue.comments     = commentHelper.mergeComments(issue, replica,
                           {
                           comment ->
                           comment.body =
                              "[" + comment.author.displayName + 
                                      "| mailto:" + comment.author.email + "]" +
                                      " commented: \n" +
                              "{quote}\n" +
                              comment.body + ";\n" +
                              "{quote}\n"
                            })
    • Use the script to impersonate the comment
    // set the real comment author for all comments;  if the author is null set a default user
    issue.comments = commentHelper.mergeComments(issue, replica) {
    	if (it.author) it.executor = it.author 
    	else it.executor = nodeHelper.getUserByEmail("default user email"); it
    }

    Comments

    • Any field available in the Comment object can be used to format the comment.