Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,18 @@ public ReadHomeResult readHome(Long spaceMemberId, Long spaceId) {
// 구독한 게시판 가져오기
List<SubscriptionSummary> subscriptions = new ArrayList<>();
List<Subscription> subscribedBoards = loadSubscriptionPort.loadBySpaceMember(spaceMemberId);
Optional<Post> latestPost;
String postTitle = "";
String tagName = "";

for (Subscription subscription : subscribedBoards) {
Board board = loadBoardPort.loadById(subscription.getBoardId());
Optional<Tag> tag = loadTagPort.loadByBoardId(board.getId());
Long tagId = subscription.getTagId();

// 각 게시판에서 제일 최신 게시물 정보 가져오기
Optional<Post> latestPost;
String postTitle = "";
String tagName = "";
if (tag.isPresent()) {
tagName = tag.get().getTagName();
latestPost = loadPostPort.loadLatestPostByBoardIdAndTagId(board.getId(), tag.get().getId());
if (tagId != null) {
Tag tag = loadTagPort.loadById(subscription.getTagId());
tagName = tag.getTagName();
latestPost = loadPostPort.loadLatestPostByBoardIdAndTagId(board.getId(), tag.getId());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if (latestPost.isPresent()) postTitle = latestPost.get().getTitle();
} else {
latestPost = loadPostPort.loadLatestPostsByBoardIds(List.of(board.getId()), 1)
Expand Down