fixed entity relation cleanup method
This commit is contained in:
		
							parent
							
								
									4cb8b54a2a
								
							
						
					
					
						commit
						46262e8709
					
				@ -282,6 +282,10 @@ public class EntityServiceTest extends AbstractControllerTest {
 | 
			
		||||
        data.forEach(entityData -> Assert.assertNotNull(entityData.getLatest().get(EntityKeyType.ENTITY_FIELD).get("phone")));
 | 
			
		||||
 | 
			
		||||
        countByQueryAndCheck(query, 5);
 | 
			
		||||
 | 
			
		||||
        // delete user
 | 
			
		||||
        userService.deleteUser(tenantId, users.get(0));
 | 
			
		||||
        countByQueryAndCheck(query, 4);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void createTestUserRelations(TenantId tenantId, List<User> users) {
 | 
			
		||||
 | 
			
		||||
@ -236,6 +236,7 @@ public class BaseRelationService implements RelationService {
 | 
			
		||||
        return Futures.transform(future, deletedEvent -> {
 | 
			
		||||
            if (deletedEvent != null) {
 | 
			
		||||
                handleEvictEvent(EntityRelationEvent.from(deletedEvent));
 | 
			
		||||
                eventPublisher.publishEvent(new RelationActionEvent(tenantId, deletedEvent, ActionType.RELATION_DELETED));
 | 
			
		||||
            }
 | 
			
		||||
            return deletedEvent != null;
 | 
			
		||||
        }, MoreExecutors.directExecutor());
 | 
			
		||||
@ -267,6 +268,7 @@ public class BaseRelationService implements RelationService {
 | 
			
		||||
 | 
			
		||||
        for (EntityRelation relation : inboundRelations) {
 | 
			
		||||
            eventPublisher.publishEvent(EntityRelationEvent.from(relation));
 | 
			
		||||
            eventPublisher.publishEvent(new RelationActionEvent(tenantId, relation, ActionType.RELATION_DELETED));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        List<EntityRelation> outboundRelations;
 | 
			
		||||
@ -278,6 +280,7 @@ public class BaseRelationService implements RelationService {
 | 
			
		||||
 | 
			
		||||
        for (EntityRelation relation : outboundRelations) {
 | 
			
		||||
            eventPublisher.publishEvent(EntityRelationEvent.from(relation));
 | 
			
		||||
            eventPublisher.publishEvent(new RelationActionEvent(tenantId, relation, ActionType.RELATION_DELETED));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user