There is 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-5787d048-e224-4d65-bcee-08a27979ed08 XWIKI-7047 Open

In a DocumentCreated EventListener, if the saved document is modified and saved again, a DocumentCreatedEvent is sent instead of a DocumentUpdatedEvent

 
View issue   ยท   Add comment
 

1 comment

 
cid:jira-generated-image-avatar-1118e364-19b5-4777-9d2e-1641cbc68cba Michael Hamann on 19/Jun/24 12:52
 

I wonder if this is actually (still) a bug. When you save a "new" document that is not actually new, this code will replace the original document by the existing document and then this code will delete the previous version of the document. Therefore, it is correct that you get a DocumentCreatedEvent as you just deleted and recreated the document. As Thomas Mortagne mentions, the real problem here is that you're modifying a shared XWikiDocument instance which is something you should never do.