Hi, everyone.
Tell me pls. Why my script not changed the status of inline comments?
import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.pages.PageManager
import com.atlassian.confluence.pages.Comment
import com.atlassian.confluence.pages.CommentManager
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.pages.CommentStatus
def pageManager = ComponentLocator.getComponent(PageManager)
def commentManager = ComponentLocator.getComponent(CommentManager)
def page = pageManager.getPage(582392168L)
def comments = commentManager.getPageComments(page.id,new Date(0))
comments = comments.findAll{comment->!comment.isDeleted()&&comment.isInlineComment()&&comment.status.isOpen()&& !comment.getParent()}
def statusBuild = new CommentStatus.Builder()
statusBuild.setValue(CommentStatus.Value.RESOLVED)
comments.each{c->
c.setStatus(statusBuild.build())
}
return 1
To update comment try to use:
commentManager.updateCommentContent(comment, comment.bodyAsString)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.