fix commentcount

This commit is contained in:
_Bastler 2021-10-06 19:04:14 +02:00
parent cdcdb64d60
commit 33ace4db2a

View File

@ -46,12 +46,12 @@ public class CommentManager {
* Fetch by date.
*
* @param username the username
* @param target the target
* @param parent the parent
* @param date the date
* @param page the page
* @param size the size
* @param desc the desc
* @param target the target
* @param parent the parent
* @param date the date
* @param page the page
* @param size the size
* @param desc the desc
* @return the page
*/
public Page<Comment> fetchByDate(String username, Long target, Long parent, Instant date,
@ -72,11 +72,11 @@ public class CommentManager {
* Fetch by username.
*
* @param username the username
* @param orElse the or else
* @param date the date
* @param page the page
* @param size the size
* @param asc the asc
* @param orElse the or else
* @param date the date
* @param page the page
* @param size the size
* @param asc the asc
* @return the page
*/
public Page<Comment> fetchByUsername(String username, Long orElse, Instant date, int page,
@ -99,7 +99,8 @@ public class CommentManager {
return count(target);
}
return commentRepository.count(qComment.target.eq(target).and(qComment.parent.eq(parent)));
return commentRepository.count(qComment.target.eq(target).and(qComment.parent.eq(parent))
.and(qComment.created.before(Instant.now())));
}
/**
@ -109,15 +110,16 @@ public class CommentManager {
* @return the long
*/
public Long count(Long target) {
return commentRepository.count(qComment.target.eq(target));
return commentRepository
.count(qComment.target.eq(target).and(qComment.created.before(Instant.now())));
}
/**
* Apply metadata.
*
* @param username the username
* @param comment the comment
* @param ignore the ignore
* @param comment the comment
* @param ignore the ignore
*/
public void applyMetadata(String username, Comment comment, List<String> ignore) {
@ -168,8 +170,8 @@ public class CommentManager {
* Apply metadata.
*
* @param username the username
* @param entries the entries
* @param ignore the ignore
* @param entries the entries
* @param ignore the ignore
*/
public void applyMetadata(String username, List<Comment> entries, List<String> ignore) {
for (Comment comment : entries) {