mirror of https://github.com/halo-dev/halo
feat: #433
parent
19862b0f79
commit
5e91fc4f6a
|
@ -19,7 +19,8 @@ import java.util.Map;
|
||||||
* PostComment event listener.
|
* PostComment event listener.
|
||||||
*
|
*
|
||||||
* @author johnniang
|
* @author johnniang
|
||||||
* @date 19-4-23
|
* @author ryanwang
|
||||||
|
* @date 2019-04-23
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
|
@ -151,6 +152,10 @@ public class CommentEventListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!baseComment.getAllowNotification()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
baseAuthorEmail = baseComment.getEmail();
|
baseAuthorEmail = baseComment.getEmail();
|
||||||
|
|
||||||
Post post = postService.getById(postComment.getPostId());
|
Post post = postService.getById(postComment.getPostId());
|
||||||
|
@ -175,6 +180,10 @@ public class CommentEventListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!baseComment.getAllowNotification()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
baseAuthorEmail = baseComment.getEmail();
|
baseAuthorEmail = baseComment.getEmail();
|
||||||
|
|
||||||
Sheet sheet = sheetService.getById(sheetComment.getPostId());
|
Sheet sheet = sheetService.getById(sheetComment.getPostId());
|
||||||
|
@ -198,6 +207,10 @@ public class CommentEventListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!baseComment.getAllowNotification()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
baseAuthorEmail = baseComment.getEmail();
|
baseAuthorEmail = baseComment.getEmail();
|
||||||
|
|
||||||
Journal journal = journalService.getById(journalComment.getPostId());
|
Journal journal = journalService.getById(journalComment.getPostId());
|
||||||
|
|
|
@ -13,6 +13,8 @@ import java.util.Date;
|
||||||
* Base comment output dto.
|
* Base comment output dto.
|
||||||
*
|
*
|
||||||
* @author johnniang
|
* @author johnniang
|
||||||
|
* @author ryanwang
|
||||||
|
* @date 2019-03-20
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ToString
|
@ToString
|
||||||
|
@ -41,6 +43,8 @@ public class BaseCommentDTO implements OutputConverter<BaseCommentDTO, BaseComme
|
||||||
|
|
||||||
private Boolean isAdmin;
|
private Boolean isAdmin;
|
||||||
|
|
||||||
|
private Boolean allowNotification;
|
||||||
|
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ import javax.persistence.*;
|
||||||
* Base comment entity.
|
* Base comment entity.
|
||||||
*
|
*
|
||||||
* @author johnniang
|
* @author johnniang
|
||||||
|
* @author ryanwang
|
||||||
|
* @date 2019-03-20
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Entity(name = "BaseComment")
|
@Entity(name = "BaseComment")
|
||||||
|
@ -79,6 +81,12 @@ public class BaseComment extends BaseEntity {
|
||||||
@Column(name = "is_admin", columnDefinition = "tinyint default 0")
|
@Column(name = "is_admin", columnDefinition = "tinyint default 0")
|
||||||
private Boolean isAdmin;
|
private Boolean isAdmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow notification.
|
||||||
|
*/
|
||||||
|
@Column(name = "allow_notification", columnDefinition = "tinyint default 1")
|
||||||
|
private Boolean allowNotification;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post id.
|
* Post id.
|
||||||
*/
|
*/
|
||||||
|
@ -132,6 +140,9 @@ public class BaseComment extends BaseEntity {
|
||||||
if (isAdmin == null) {
|
if (isAdmin == null) {
|
||||||
isAdmin = false;
|
isAdmin = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if (allowNotification == null) {
|
||||||
|
allowNotification = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ import java.lang.reflect.ParameterizedType;
|
||||||
* Base Comment param.
|
* Base Comment param.
|
||||||
*
|
*
|
||||||
* @author johnniang
|
* @author johnniang
|
||||||
* @date 3/22/19
|
* @author ryanwang
|
||||||
|
* @date 2019-03-22
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public abstract class BaseCommentParam<COMMENT> implements InputConverter<COMMENT> {
|
public abstract class BaseCommentParam<COMMENT> implements InputConverter<COMMENT> {
|
||||||
|
@ -43,6 +44,8 @@ public abstract class BaseCommentParam<COMMENT> implements InputConverter<COMMEN
|
||||||
@Min(value = 0, message = "PostComment parent id must not be less than {value}")
|
@Min(value = 0, message = "PostComment parent id must not be less than {value}")
|
||||||
private Long parentId = 0L;
|
private Long parentId = 0L;
|
||||||
|
|
||||||
|
private Boolean allowNotification = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ParameterizedType parameterizedType() {
|
public ParameterizedType parameterizedType() {
|
||||||
return ReflectionUtils.getParameterizedTypeBySuperClass(BaseCommentParam.class, this.getClass());
|
return ReflectionUtils.getParameterizedTypeBySuperClass(BaseCommentParam.class, this.getClass());
|
||||||
|
|
Loading…
Reference in New Issue