There seem to be two symptoms with a common cause:
As an Agent, I hit the Share With Customer button to convert a Private comment to a Public comment. The Comment_Edited event is fired, which is correct, however, it seems that the Event Declaring this change fires before JSD sets the entity properties of the comment that indicate the comments public nature. This means that Event Listeners would be unable to differentiate between a JSD Private comment and a JSD Private comment that was just Shared, meaning end-users will not be notified about such public features.
We've found that with no other changes, as an Event Listener we receive comments that (a) have no entity properties defined (we see the entity property showing none()) , or (b) have entity properties defined. One possible explanation is that JSD is updating entity properties in an Event Listener callback, and the Set of Event Listeners notified is not a repeatable sequence:
- If the JSD Event Listener is registered before ours, then the comment entity properties are set and treated as private (b)
- If our Event Listener is registered first, then no properties are found and the comment is treated as public (a)
It would be a race condition driven by the use of Event Listeners to set entity properties. With no deterministic way to detect JSD private comments in addons, addons will leak private information.
The entity property identifying the comment as public must be set before the event is fired to ANY Event Listener. JSD should create the comment, without firing an event, setup its properties, then fire the event.