Would be better next time to have a jira issue associated with commits
like this one, especially since you're changing something visible to
the user. Didn't you open a jira issue already when you made those
changes to DefaultDocumentAccessBridge earlier on?
BTW shouldn't this be i18ned? Are we doing that for other save messages?
Thanks
-Vincent
On Jan 7, 2009, at 7:28 AM, asiri (SVN) wrote:
Author: asiri
Date: 2009-01-07 07:28:11 +0100 (Wed, 07 Jan 2009)
New Revision: 15118
Modified:
platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/
DefaultDocumentAccessBridge.java
Log:
Addressing review comments.
* Improced javadoc comemnts.
* Added an editComments when changing document syntaxId
* Prevented re-saving the XWikiDocument after calling
doc.saveAttachmentContent()
Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/
doc/DefaultDocumentAccessBridge.java
===================================================================
--- platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/
DefaultDocumentAccessBridge.java 2009-01-06 23:15:02 UTC (rev 15117)
+++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/doc/
DefaultDocumentAccessBridge.java 2009-01-07 06:28:11 UTC (rev 15118)
@@ -116,8 +116,10 @@
{
XWikiContext xcontext = getContext();
XWikiDocument doc =
xcontext.getWiki().getDocument(documentName, xcontext);
+ String oldSyntaxId = doc.getSyntaxId();
doc.setSyntaxId(syntaxId);
- xcontext.getWiki().saveDocument(doc, xcontext);
+ xcontext.getWiki().saveDocument(doc,
+ String.format("Changed document syntax from [%s] to
[%s].", oldSyntaxId, syntaxId), xcontext);
}
/**
@@ -241,8 +243,6 @@
attachment.setAuthor(xcontext.getUser());
attachment.setDoc(doc);
doc.saveAttachmentContent(attachment, xcontext);
- xcontext.getWiki().saveDocument(doc,
- String.format("Added attachment [%s].",
AttachmentName), xcontext);
}
/**
@@ -326,6 +326,8 @@
}
/**
+ * Utility method for checking access rights of the current
user on a target document.
+ *
* @param documentName The name of the document.
* @param right Access right requested.
* @return True if the current user has the given access right,
false otherwise.