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/BRANCHES/DEV/5.2.N/root@128215 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-06-21 11:06:01 +00:00
parent 125f58363b
commit 79410c9787
4 changed files with 215 additions and 55 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);