From c7625278bfa312db5338bf70992fe8f2fce629da Mon Sep 17 00:00:00 2001 From: Lee-DoHa Date: Thu, 24 Nov 2022 12:04:57 +0900 Subject: [PATCH] Update MessageService.java --- .../project/csletter/message/service/MessageService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/project/csletter/message/service/MessageService.java b/src/main/java/com/project/csletter/message/service/MessageService.java index 8e6a7a2..5b87745 100644 --- a/src/main/java/com/project/csletter/message/service/MessageService.java +++ b/src/main/java/com/project/csletter/message/service/MessageService.java @@ -129,12 +129,13 @@ public List getMessageFeed(Long cursor, Pageable pageable, f.setPrevCursor(messages.get(messages.size() - 1).getId()); } } - - - f.setNextCursor(mainList.get(mainList.size()-1).getMessageId()); }); + if(!mainList.get(mainList.size() - 1).getHaveNextMessage()) { + mainList.forEach(f -> f.setNextCursor(null)); + } + return mainList; }