fix usercomments

This commit is contained in:
_Bastler 2021-10-06 13:16:30 +02:00
parent 7e0c292d7c
commit 06e402a8f2
1 changed files with 21 additions and 23 deletions

View File

@ -45,12 +45,12 @@ public class CommentManager {
/**
* Fetch by ranking.
*
* @param target the target
* @param parent the parent
* @param date the date
* @param target the target
* @param parent the parent
* @param date the date
* @param gravity the gravity
* @param page the page
* @param size the size
* @param page the page
* @param size the size
* @return the page
*/
@ -70,10 +70,10 @@ public class CommentManager {
*
* @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 date the date
* @param page the page
* @param size the size
* @param desc the desc
* @return the page
*/
public Page<Comment> fetchByDate(Long target, Long parent, Instant date, int page, int size,
@ -95,21 +95,19 @@ 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,
int size, boolean asc) {
Sort sort = Sort.by(asc ? Order.asc("created") : Order.desc("created"));
return commentRepository
.findAll(
qComment.author.equalsIgnoreCase(username).and(qComment.parent.isNull())
.and(qComment.created.before(date)),
PageRequest.of(page, size, sort));
return commentRepository.findAll(
qComment.author.equalsIgnoreCase(username).and(qComment.created.before(date)),
PageRequest.of(page, size, sort));
}
/**
@ -141,8 +139,8 @@ public class CommentManager {
* 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) {
@ -193,8 +191,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) {