@@ -122,7 +122,7 @@ private Map<Long, Long> countDirectReposts(List<Feed> feeds) {
122122
123123 private Map <Long , Feed > bulkLoadParents (List <Feed > feeds ) {
124124 Set <Long > parentIds = feeds .stream ()
125- .map (f -> f . getParent () != null ? f . getParent (). getFeedId () : null )
125+ .map (Feed :: getParentFeedId )
126126 .filter (Objects ::nonNull )
127127 .collect (Collectors .toSet ());
128128 if (parentIds .isEmpty ()) return Collections .emptyMap ();
@@ -185,11 +185,13 @@ private FeedOverviewDto toOverviewDto(
185185 .created (f .getCreatedAt ())
186186 .repostCount (selfRepostCount );
187187
188- Feed parent = f .getParent ();
189- if (parent != null ) {
190- long parentRepostCount = repostCntMap .getOrDefault (parent .getFeedId (), 0L );
191- Feed p = parentMap .getOrDefault (parent .getFeedId (), parent ); // 영속성 컨텍스트에 이미 있을 수도
192- b .parentFeed (toShallowDto (p , currentUserId , likedFeedIds , parentRepostCount ));
188+ Long parentId = f .getParentFeedId ();
189+ if (parentId != null ) {
190+ Feed p = parentMap .get (parentId );
191+ if (p != null ) {
192+ long parentRepostCount = repostCntMap .getOrDefault (parentId , 0L );
193+ b .parentFeed (toShallowDto (p , currentUserId , likedFeedIds , parentRepostCount ));
194+ }
193195 }
194196
195197 Long rootId = f .getRootFeedId ();
@@ -246,10 +248,10 @@ public void createRefeed(Long parentFeedId, Long targetClubId, RefeedRequestDto
246248 Feed parent = feedRepository .findById (parentFeedId )
247249 .orElseThrow (() -> new CustomException (ErrorCode .FEED_NOT_FOUND ));
248250
249- int newDepth = parent .getDepth () + 1 ;
250- if (newDepth > MAX_REFEED_DEPTH ) {
251- throw new CustomException (ErrorCode .REFEED_DEPTH_LIMIT );
252- }
251+ // int newDepth = parent.getDepth() + 1;
252+ // if (newDepth > MAX_REFEED_DEPTH) {
253+ // throw new CustomException(ErrorCode.REFEED_DEPTH_LIMIT);
254+ // }
253255
254256 Club club = clubRepository .findById (targetClubId )
255257 .orElseThrow (() -> new CustomException (ErrorCode .CLUB_NOT_FOUND ));
@@ -263,9 +265,9 @@ public void createRefeed(Long parentFeedId, Long targetClubId, RefeedRequestDto
263265 Feed reFeed = Feed .builder ()
264266 .content (requestDto .getContent ())
265267 .feedType (FeedType .REFEED )
266- .parent ( parent )
268+ .parentFeedId ( parentFeedId )
267269 .rootFeedId (rootId )
268- .depth (newDepth )
270+ // .depth(newDepth)
269271 .club (club )
270272 .user (user )
271273 .build ();
0 commit comments