mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-11 09:30:56 +08:00
Revert "feat: add paginated notification APIs and frontend"
This reverts commit 7dd1f1b3d0.
This commit is contained in:
@@ -180,16 +180,15 @@ public class NotificationService {
|
||||
userRepository.save(user);
|
||||
}
|
||||
|
||||
public List<Notification> listNotifications(String username, Boolean read, int page) {
|
||||
public List<Notification> listNotifications(String username, Boolean read) {
|
||||
User user = userRepository.findByUsername(username)
|
||||
.orElseThrow(() -> new com.openisle.exception.NotFoundException("User not found"));
|
||||
Set<NotificationType> disabled = user.getDisabledNotificationTypes();
|
||||
List<Notification> list;
|
||||
var pageable = org.springframework.data.domain.PageRequest.of(page, 50);
|
||||
if (read == null) {
|
||||
list = notificationRepository.findByUserOrderByCreatedAtDesc(user, pageable).getContent();
|
||||
list = notificationRepository.findByUserOrderByCreatedAtDesc(user);
|
||||
} else {
|
||||
list = notificationRepository.findByUserAndReadOrderByCreatedAtDesc(user, read, pageable).getContent();
|
||||
list = notificationRepository.findByUserAndReadOrderByCreatedAtDesc(user, read);
|
||||
}
|
||||
return list.stream().filter(n -> !disabled.contains(n.getType())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user