Merged 5.2.N (5.2.1) to HEAD (5.2)

128215 adavis: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
      128190 amorarasu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2)
         128171 amukha: MNT-16401: Delete comment notification from Blog or Links is not displayed in Site Activities dashlet
            - Corrected the comemnts webscript.
            - Added JUnit tests.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@129278 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alexandru Epure
2016-08-09 13:51:28 +00:00
parent 0dffb373fd
commit 9621978d0c
4 changed files with 240 additions and 80 deletions

View File

@@ -68,6 +68,24 @@ public class CommentDelete extends AbstractCommentsWebScript
parentNodeRef = new NodeRef((String) getOrNull(jsonPageParams, JSON_KEY_NODEREF));
}
if (parentNodeRef == null)
{
// find the parent content node for the comment
// Example would be a blog post which will have the following structure:
// blog post -> forum node -> topic node -> the actual comment node
NodeRef topicNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef();
if (topicNodeRef == null || !nodeService.getType(topicNodeRef).equals(ForumModel.TYPE_TOPIC))
{
throw new IllegalArgumentException("The NodeRef specified is not a child of the topic.");
}
NodeRef forumNodeRef = nodeService.getPrimaryParent(topicNodeRef).getParentRef();
if (forumNodeRef == null || !nodeService.getType(forumNodeRef).equals(ForumModel.TYPE_FORUM))
{
throw new IllegalArgumentException("The NodeRef specified doesn't belong to a correct structure of forums.");
}
parentNodeRef = nodeService.getPrimaryParent(forumNodeRef).getParentRef();
}
if (parentNodeRef != null)
{
this.behaviourFilter.disableBehaviour(parentNodeRef, ContentModel.ASPECT_AUDITABLE);