Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -95,6 +95,7 @@ public FeedsGetResponse getFeeds(User user, Long lastFeedId, int size,
Slice<Feed> feeds = findFeedsByCategoryLabel(lastFeedId, userIdOrNull,
PageRequest.of(DEFAULT_PAGE_NUMBER, size), feedGetOption, genres);

// TODO: feed -> feed.isVisibleTo(userIdOrNull) 해당 필터링 로직은 필요 없음
List<FeedInfo> feedGetResponses = feeds.getContent().stream().filter(feed -> feed.isVisibleTo(userIdOrNull))
.map(feed -> createFeedInfo(feed, user)).toList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ public Slice<Feed> findRecommendedFeeds(Long lastFeedId, Long userId, PageReques
checkPopularFeed(),
checkGenresAndNovels(genres, true),
checkBlocking(userId),
checkHidden()
checkHidden(),
checkVisible(userId)
)
.limit(pageRequest.getPageSize() + 1)
.orderBy(feed.feedId.desc())
Expand All @@ -181,7 +182,8 @@ public Slice<Feed> findInterestedNovelFeeds(Long lastFeedId, Long userId, PageRe
ltFeedId(lastFeedId),
checkBlocking(userId),
checkHidden(),
checkInterestedNovels(userId)
checkInterestedNovels(userId),
checkVisible(userId)
)
.limit(pageRequest.getPageSize() + 1)
.orderBy(feed.feedId.desc())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public interface FeedRepository extends JpaRepository<Feed, Long>, FeedCustomRep
@Query(value = "SELECT f FROM Feed f WHERE "
+ "(:lastFeedId = 0 OR f.feedId < :lastFeedId) "
+ "AND f.isHidden = false "
+ "AND (f.isPublic = true OR f.user.userId = :userId)"
+ "AND (:userId IS NULL "
+ "OR f.user.userId NOT IN (SELECT b.blockedId FROM Block b WHERE b.blockingId = :userId)) "
+ "ORDER BY f.feedId DESC")
Expand All @@ -29,6 +30,7 @@ public interface FeedRepository extends JpaRepository<Feed, Long>, FeedCustomRep
+ "(:lastFeedId = 0 OR f.feedId < :lastFeedId) "
+ "AND f.novelId = :novelId "
+ "AND f.isHidden = false "
+ "AND (f.isPublic = true OR f.user.userId = :userId)"
+ "AND (:userId IS NULL "
+ "OR f.user.userId NOT IN (SELECT b.blockedId FROM Block b WHERE b.blockingId = :userId)) "
+ "ORDER BY f.feedId DESC")
Expand Down
Loading