Hi (Thomas),
I’ve found a regression while analyzing why
http://ci.xwiki.org/job/xwiki-platform/org.xwiki.platform$xwiki-platform-re…
is failing.
The inline action works fine and correctly sets the cdoc (which contains the template
content copied to the new doc).
The issue is that when inline.vm executes (evaluateTemplate()), this calls
getVelocityContext() which calls XWikiScriptContextInitializer and this line (added in rev
955505595b95784876777a7059fb3bc725c01776) is executed:
setDocument(scriptContext, "cdoc", cdoc, xcontext);
This line executes:
private void setDocument(ScriptContext scriptContext, String key, XWikiDocument document,
XWikiContext xcontext)
{
Document previousDoc = (Document) scriptContext.getAttribute(key);
if (previousDoc == null ||
!previousDoc.getDocumentReference().equals(document.getDocumentReference())) {
Document apiDocument = document.newDocument(xcontext);
scriptContext.setAttribute(key, apiDocument, ScriptContext.ENGINE_SCOPE);
}
}
And since there’s a previousDoc, it’s set as the cdoc and thus then editinline.vm executes
the cdoc is the original one and not the one modified by the InlineAction.java code (ie
with the template copied).
Apparently this commit was done in:
https://github.com/xwiki/xwiki-platform/commit/955505595b95784876777a7059fb…
@Thomas: could I let you handle this? (since I don’t know this code and its logic).
Thanks
-Vincent