On Tue, Jan 12, 2010 at 19:45, Vincent Massol <vincent(a)massol.net> wrote:
On Jan 12, 2010, at 7:37 PM, tmortagne (SVN) wrote:
Author: tmortagne
Date: 2010-01-12 19:37:07 +0100 (Tue, 12 Jan 2010)
New Revision: 26113
Modified:
platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java
Log:
XWIKI-4744: DocumentDeleteEvent event does not come with proper user in the source
document
Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java
===================================================================
--- platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java 2010-01-12
18:29:37 UTC (rev 26112)
+++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java 2010-01-12
18:37:07 UTC (rev 26113)
@@ -4105,6 +4105,8 @@
if (om != null) {
XWikiDocument blankDoc = new XWikiDocument(doc.getWikiName(),
doc.getSpace(), doc.getName());
blankDoc.setOriginalDocument(doc);
+ blankDoc.setAuthor(context.getUser());
+ blankDoc.setContentAuthor(context.getUser());
om.notify(new DocumentDeleteEvent(doc.getWikiName() + ":" +
doc.getFullName()), blankDoc, context);
hmmm I was wondering if setAuthor in delete event is correct or not. I think it's
missing some comments to explain it.
Does it mean that we consider the deleted document as having been written by the user
who's deleted it? (which doesn't make complete sense, does it?)
The source document should have the author as the original one I think, unless we
consider the "source" as not representing the deleted document. But then what is
it representing?
In all document events "source" is the new document state, you get the
old state using source.getOriginalDocument()
Thanks
-Vincent
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs