Search in sources :

Example 1 with CommentViolationTypeEnum

use of run.halo.app.model.enums.CommentViolationTypeEnum in project halo by ruibaby.

the class PostCommentServiceImpl method validateCommentBlackListStatus.

@Override
public void validateCommentBlackListStatus() {
    CommentViolationTypeEnum banStatus = commentBlackListService.commentsBanStatus(ServletUtils.getRequestIp());
    Integer banTime = optionService.getByPropertyOrDefault(CommentProperties.COMMENT_BAN_TIME, Integer.class, 10);
    if (banStatus == CommentViolationTypeEnum.FREQUENTLY) {
        throw new ForbiddenException(String.format("您的评论过于频繁,请%s分钟之后再试。", banTime));
    }
}
Also used : ForbiddenException(run.halo.app.exception.ForbiddenException) CommentViolationTypeEnum(run.halo.app.model.enums.CommentViolationTypeEnum)

Example 2 with CommentViolationTypeEnum

use of run.halo.app.model.enums.CommentViolationTypeEnum in project halo by halo-dev.

the class PostCommentServiceImpl method validateCommentBlackListStatus.

@Override
public void validateCommentBlackListStatus() {
    CommentViolationTypeEnum banStatus = commentBlackListService.commentsBanStatus(ServletUtils.getRequestIp());
    Integer banTime = optionService.getByPropertyOrDefault(CommentProperties.COMMENT_BAN_TIME, Integer.class, 10);
    if (banStatus == CommentViolationTypeEnum.FREQUENTLY) {
        throw new ForbiddenException(String.format("您的评论过于频繁,请%s分钟之后再试。", banTime));
    }
}
Also used : ForbiddenException(run.halo.app.exception.ForbiddenException) CommentViolationTypeEnum(run.halo.app.model.enums.CommentViolationTypeEnum)

Example 3 with CommentViolationTypeEnum

use of run.halo.app.model.enums.CommentViolationTypeEnum in project halo-plugin-experimental by guqing.

the class PostCommentServiceImpl method validateCommentBlackListStatus.

@Override
public void validateCommentBlackListStatus() {
    CommentViolationTypeEnum banStatus = commentBlackListService.commentsBanStatus(ServletUtils.getRequestIp());
    Integer banTime = optionService.getByPropertyOrDefault(CommentProperties.COMMENT_BAN_TIME, Integer.class, 10);
    if (banStatus == CommentViolationTypeEnum.FREQUENTLY) {
        throw new ForbiddenException(String.format("您的评论过于频繁,请%s分钟之后再试。", banTime));
    }
}
Also used : ForbiddenException(run.halo.app.exception.ForbiddenException) CommentViolationTypeEnum(run.halo.app.model.enums.CommentViolationTypeEnum)

Aggregations

ForbiddenException (run.halo.app.exception.ForbiddenException)3 CommentViolationTypeEnum (run.halo.app.model.enums.CommentViolationTypeEnum)3