Author: vmassol
Date: 2007-09-12 18:10:22 +0200 (Wed, 12 Sep 2007)
New Revision: 4880

Modified:
   xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java
Log:
XWIKI-1739: Document change notification not sent for new documents
Patch submitted by Raffaello
Reviewed by Vincent Massol

Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java
===================================================================
--- xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java 
2007-09-12 15:43:32 UTC (rev 4879)
+++ xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java 
2007-09-12 16:10:22 UTC (rev 4880)
@@ -950,10 +950,14 @@
             doc.setComment((comment == null) ? "" : comment);
             doc.setMinorEdit(isMinorEdit);
 
+            // We need to save the original document since saveXWikiDoc() will 
reset it and we
+            // need that original document for the notification below.
+            XWikiDocument originalDocument = doc.getOriginalDocument();
+
             getStore().saveXWikiDoc(doc, context);
 
             // Notify listeners about the document change
-            getNotificationManager().verify(doc, doc.getOriginalDocument(),
+            getNotificationManager().verify(doc, originalDocument,
                 XWikiDocChangeNotificationInterface.EVENT_CHANGE, context);
         } finally {
             if ((server != null) && (database != null)) {
@@ -1063,7 +1067,7 @@
     }
 
     /**
-     * @see com.xpn.xwiki.api.XWiki#getDeletedDocuments(String)
+     * @see com.xpn.xwiki.api.XWiki#getDeletedDocuments(String, String)
      */
     public XWikiDeletedDocument[] getDeletedDocuments(String fullname, String 
lang, XWikiContext context) throws XWikiException
     {
@@ -1076,8 +1080,9 @@
             return null;
         }
     }
+
     /**
-     * @see com.xpn.xwiki.api.XWiki#getDeletedDocument(String, String, int)
+     * @see com.xpn.xwiki.api.XWiki#getDeletedDocument(String, String, String) 
 
      */
     public XWikiDeletedDocument getDeletedDocument(String fullname, String 
lang, int index, XWikiContext context) throws XWikiException
     {

_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to