mirror of https://github.com/halo-dev/halo
Add filter ip address service in BaseCommentService
parent
bd7b87aa50
commit
427a0b86e7
|
@ -214,4 +214,25 @@ public interface BaseCommentService<COMMENT extends BaseComment> extends CrudSer
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
List<COMMENT> listChildrenBy(@NonNull Integer targetId, @NonNull Long commentParentId, @NonNull CommentStatus status, @NonNull Sort sort);
|
List<COMMENT> listChildrenBy(@NonNull Integer targetId, @NonNull Long commentParentId, @NonNull CommentStatus status, @NonNull Sort sort);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters comment ip address.
|
||||||
|
*
|
||||||
|
* @param comment comment dto must not be null
|
||||||
|
*/
|
||||||
|
void filterIpAddress(@NonNull BaseCommentDTO comment);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters comment ip address.
|
||||||
|
*
|
||||||
|
* @param comments comment dto list
|
||||||
|
*/
|
||||||
|
void filterIpAddress(@Nullable List<BaseCommentDTO> comments);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters comment ip address.
|
||||||
|
*
|
||||||
|
* @param commentPage comment page
|
||||||
|
*/
|
||||||
|
void filterIpAddress(@NonNull Page<BaseCommentDTO> commentPage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -470,6 +470,29 @@ public abstract class BaseCommentServiceImpl<COMMENT extends BaseComment> extend
|
||||||
return childrenList;
|
return childrenList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void filterIpAddress(BaseCommentDTO comment) {
|
||||||
|
Assert.notNull(comment, "Base comment dto must not be null");
|
||||||
|
|
||||||
|
// Clear ip address
|
||||||
|
comment.setIpAddress("");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void filterIpAddress(List<BaseCommentDTO> comments) {
|
||||||
|
if (CollectionUtils.isEmpty(comments)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
comments.forEach(this::filterIpAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void filterIpAddress(Page<BaseCommentDTO> commentPage) {
|
||||||
|
Assert.notNull(commentPage, "Comment page must not be null");
|
||||||
|
commentPage.forEach(this::filterIpAddress);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get children comments recursively.
|
* Get children comments recursively.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue