On 27 Nov 2014 at 14:51:40, vincent(a)massol.net
(vincent@massol.net(mailto:vincent@massol.net)) wrote:
On 27 Nov 2014 at 14:37:50, Adrien Moi
(adrienmoi1988@hotmail.com(mailto:adrienmoi1988@hotmail.com)) wrote:
Hello
In a groovy macro I can access the comments on the page like this :
comments = doc.getComments();
now I want to delete the last one... how can I do that?
I tried :
comments[0].delete();
but it doesn't work....
do you know what to type to make it work?
You can get the xobjects of type XWiki.XWikiComments and remove the last one.
Check $doc in the SRD. Something like $doc.getObjects(“XWiki.XWikiComments”) and then
$doc.removeObject(objct).
And don’t forget to save the doc in the end: $doc.save(…).
Would be interesting to have a code snippet on
extensions.xwiki.org(http://extensions.xwiki.org) showing this…