Use the right event subscriber to make sure all comments are removed from the catalog, if their content object is deleted.
svn path=/plone.app.discussion/trunk/; revision=40485
This commit is contained in:
		
							parent
							
								
									1edbf3a262
								
							
						
					
					
						commit
						51d6c60412
					
				@ -39,7 +39,7 @@
 | 
			
		||||
 | 
			
		||||
      <subscriber
 | 
			
		||||
          for="Products.CMFCore.interfaces.IContentish
 | 
			
		||||
               zope.lifecycleevent.interfaces.IObjectAddedEvent"
 | 
			
		||||
               zope.lifecycleevent.interfaces.IObjectRemovedEvent"
 | 
			
		||||
          handler=".comment.notify_content_object_deleted"
 | 
			
		||||
          />
 | 
			
		||||
          
 | 
			
		||||
 | 
			
		||||
@ -277,9 +277,14 @@ class CommentCatalogTest(PloneTestCase):
 | 
			
		||||
        self.assertEquals(len(brains), 0)
 | 
			
		||||
 | 
			
		||||
    def test_remove_comments_when_content_object_is_removed(self):
 | 
			
		||||
        # Make sure all comments are removed from the catalog, if the content
 | 
			
		||||
        # object is removed.
 | 
			
		||||
        pass
 | 
			
		||||
        """Make sure all comments are removed from the catalog, if the content
 | 
			
		||||
           object is removed.
 | 
			
		||||
        """
 | 
			
		||||
        brains = self.catalog.searchResults(portal_type = 'Discussion Item')
 | 
			
		||||
        self.assertEquals(len(brains), 1)
 | 
			
		||||
        self.portal.manage_delObjects(["doc1"])
 | 
			
		||||
        brains = self.catalog.searchResults(portal_type = 'Discussion Item')
 | 
			
		||||
        self.assertEquals(len(brains), 0)
 | 
			
		||||
            
 | 
			
		||||
    def test_clear_and_rebuild_catalog(self):
 | 
			
		||||
        # Clear and rebuild catalog
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user