Creating a ticket with a comment that is set as public does not actually get set as public.
Describe the bug
When creating a ticket, if a Comment is set to public (using setPublic(true)), the comment isn't actually set to public when the ticket is created.
To Reproduce
Ticket ticket = new Ticket();
ticket.setRequester(new Ticket.Requester(createTicketRequest.getEmail(), createTicketRequest.getEmail()));
Comment comment = new Comment("My initial comment");
comment.setPublic(true);
ticket.setComment(comment);
ticket.setDescription("Some description");
ticket.setTags(getTags());
ticket.setSubject("My subject");
ticket.setTicketFormId(formId);
zenDeskInstance.getApiClient().createTicket(ticket);
The comment created with this ticket does not have the "public" attribute set to true.
Turning on "debug" logging, we can see the comment in the JSON request has "public" set to false.
"events": [
...
{
"id": 30911026078611,
"type": "Comment",
"author_id": 30767222336211,
"body": "My initial comment",
"html_body": "<div class=\"zd-comment\" dir=\"auto\"><p dir=\"auto\">My initial comment</p></div>",
"plain_body": "My initial comment",
"public": false,
"attachments": [],
"audit_id": 30903023478483
},
...
]
Expected behavior We would expect the comment flagged as public to be public.
It should be noted that if you first create the ticket then create a separate request to create a comment (with the comment set to public), that it actually works as expected (the comment is created with the public flag set to true).
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information): N/A
Smartphone (please complete the following information): N/A