On Tue, Apr 12, 2016 at 10:11 PM, Vincent Massol <vinc...@massol.net> wrote: > Hi Peter, > >> On 05 Apr 2016, at 19:28, Peter Huisman <p.huis...@ximm.nl> wrote: >> >> From the XWiki source code, I see there is a difference in passing a >> document to the evenmanager: >> >> The DocumentDeletingEvent is passing a “new >> XWikiDocument(doc.getDocumentReference())" >> The DocumentUpdatedEvent (as an example) is passing the doc (the actual >> XWikiDocument) >> >> The difference is, that the Document passed in the DeleteEvent is a new >> XWikiDocument and not the XWikiDocument that is about to be deleted. >> >> Is there a reason why this difference exists? > > he code in the XWiki class doing the notify has been there for a long time > AFAICS: > > om.notify(new DocumentDeletingEvent(doc.getDocumentReference()), > new XWikiDocument(doc.getDocumentReference()), context); > > However, I think it’s not correct. I think it should pass the document and > not a clone, because an Event Listener should be able to modify the instance > that’s going to be saved.
It's a delete not a save so modifying it would be useless. I guess the intend here was to have the same kind of data than what you get with DocumentDeletedEvent. What is wrong and should be fixed is that the document sent with the event should have the real one as original document (exactly like it's done for DocumentDeletedEvent). > > So I’d open a bug for this. Let’s see if the others agree. > > Thanks > -Vincent > >> Br, >> >> Peter > > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users