Hi, im trying to modify the visibility restriction of a comment to no restriction.
First of all i add a comment using this:
def body
//def roleType = "Nivel 1"
def commentBody = "test"
def roleType = null
def issueKey = "<IssueKey>"
if(roleType != null){
def tempCommentBody = "[Internal] " + commentBody
body = [
"visibility": [
"type": "role",
"value": roleType
],
"body": tempCommentBody
]
logger.info "Create comment BODY:" + body
} else {
logger.info "Visibilidad public"
def tempCommentBody = "[Public] " + commentBody
body = ["body": tempCommentBody]
logger.info "Create comment BODY:" + body
}
def response2 = post("/rest/api/2/issue/${issueKey}/comment")
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.body(body)
.asJson()
after the creation you can save the comment id using:
def commentId = response2.body.array[0].id.toString()```
and after that you can modify the visibility from null to "nivel 1"using:
def response = put("/rest/api/2/issue/${issueKey}/comment/${commentId }")
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.body(body)
.asJson()
That is working, but if i try to do the reverse, going from “nivel 1” to nothing is not working, in this case u just need to uncomment the line roletype to the other one and that update the comment.
That was working before but not anymore. I’m missing something?
Thanks!