Issue Summary
Deleting Jira issue comments using the Jira Java API "com.atlassian.jira.issue.comments.CommentManager.delete" does not update the comment_version table if we set dispatchEvent as false.
Steps to Reproduce
- Create a Jira instance on version 9.12.18 or 9.12.19
- Create a Project and a Jira issue under the project.
- Assume the Jira issue key created is "ABC-1"
- Create a few comments on ABC-1
- Use the below Java API script to delete the comments from the Jira issue "ABC-1".
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.comments.Comment import com.atlassian.jira.issue.comments.CommentManager import com.atlassian.jira.user.ApplicationUser // Define the specific issue key String issueKey = "ABC-1" IssueManager issueManager = ComponentAccessor.getIssueManager() CommentManager commentManager = ComponentAccessor.getCommentManager() // Get the specific issue by the issue key Issue issue = issueManager.getIssueByKeyIgnoreCase(issueKey) if (issue) { // Get comments for the specific issue List<Comment> userComments = commentManager.getComments(issue).findAll { comment -> comment.getAuthorApplicationUser() == getUser("admin") } // Delete the comments if (userComments) { userComments.each { comment -> commentManager.delete(comment, false, getUser("admin")) } } } ApplicationUser getUser(String userName) { return ComponentAccessor.getUserManager().getUserByName(userName) }
- I've used ScriptRunner plugin console to execute the script.
Expected Results
All the comments will be deleted from the Jira issue, and the "index_version" (e.g., 1 -> 2) and "deleted" (N -> Y) columns of the "comment_version" table should be updated.
Actual Results
All the comments from the Jira issue are getting deleted, but the changes are not reflected in the "comment_version" table.
Workaround
The workaround is to set "dispatchEvent=true" while initiating the Java API.
- is related to
-
JRASERVER-77779 Creating comments using CommentManager without dispatching an event resulting in comments without an entity version
-
- Gathering Impact
-
- mentioned in
-
Page Loading...