pull/435/head
ruibaby 2019-12-21 19:52:08 +08:00
parent 19862b0f79
commit 5e91fc4f6a
4 changed files with 34 additions and 3 deletions

View File

@ -19,7 +19,8 @@ import java.util.Map;
* PostComment event listener.
*
* @author johnniang
* @date 19-4-23
* @author ryanwang
* @date 2019-04-23
*/
@Slf4j
@Component
@ -151,6 +152,10 @@ public class CommentEventListener {
return;
}
if (!baseComment.getAllowNotification()) {
return;
}
baseAuthorEmail = baseComment.getEmail();
Post post = postService.getById(postComment.getPostId());
@ -175,6 +180,10 @@ public class CommentEventListener {
return;
}
if (!baseComment.getAllowNotification()) {
return;
}
baseAuthorEmail = baseComment.getEmail();
Sheet sheet = sheetService.getById(sheetComment.getPostId());
@ -198,6 +207,10 @@ public class CommentEventListener {
return;
}
if (!baseComment.getAllowNotification()) {
return;
}
baseAuthorEmail = baseComment.getEmail();
Journal journal = journalService.getById(journalComment.getPostId());

View File

@ -13,6 +13,8 @@ import java.util.Date;
* Base comment output dto.
*
* @author johnniang
* @author ryanwang
* @date 2019-03-20
*/
@Data
@ToString
@ -41,6 +43,8 @@ public class BaseCommentDTO implements OutputConverter<BaseCommentDTO, BaseComme
private Boolean isAdmin;
private Boolean allowNotification;
private Date createTime;
}

View File

@ -12,6 +12,8 @@ import javax.persistence.*;
* Base comment entity.
*
* @author johnniang
* @author ryanwang
* @date 2019-03-20
*/
@Data
@Entity(name = "BaseComment")
@ -79,6 +81,12 @@ public class BaseComment extends BaseEntity {
@Column(name = "is_admin", columnDefinition = "tinyint default 0")
private Boolean isAdmin;
/**
* Allow notification.
*/
@Column(name = "allow_notification", columnDefinition = "tinyint default 1")
private Boolean allowNotification;
/**
* Post id.
*/
@ -132,6 +140,9 @@ public class BaseComment extends BaseEntity {
if (isAdmin == null) {
isAdmin = false;
}
}
if (allowNotification == null) {
allowNotification = true;
}
}
}

View File

@ -15,7 +15,8 @@ import java.lang.reflect.ParameterizedType;
* Base Comment param.
*
* @author johnniang
* @date 3/22/19
* @author ryanwang
* @date 2019-03-22
*/
@Data
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}")
private Long parentId = 0L;
private Boolean allowNotification = true;
@Override
public ParameterizedType parameterizedType() {
return ReflectionUtils.getParameterizedTypeBySuperClass(BaseCommentParam.class, this.getClass());