Hi (Thomas),

I’ve found a regression while analyzing why 
http://ci.xwiki.org/job/xwiki-platform/org.xwiki.platform$xwiki-platform-release-test-tests/3127/testReport/org.xwiki.release.test.ui/ReleaseTest/testRelease/
 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/955505595b95784876777a7059fb3bc725c01776#diff-bf8a5403fbc32bd20f7f3687062f1a24R105

@Thomas: could I let you handle this? (since I don’t know this code and its 
logic).

Thanks
-Vincent


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

Reply via email to