Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

300 comment limit. #3306

Merged
merged 3 commits into from
Jul 3, 2023
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
1 change: 0 additions & 1 deletion crates/api_common/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ pub async fn remove_user_data_in_community(
.pool(pool)
.creator_id(Some(banned_person_id))
.community_id(Some(community_id))
.limit(Some(i64::MAX))
.build()
.list()
.await?;
Expand Down
9 changes: 6 additions & 3 deletions crates/db_views/src/comment_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use lemmy_db_schema::{
post::Post,
},
traits::JoinView,
utils::{fuzzy_search, get_conn, limit_and_offset_unlimited, DbPool},
utils::{fuzzy_search, get_conn, limit_and_offset, DbPool},
CommentSortType,
ListingType,
};
Expand Down Expand Up @@ -340,9 +340,12 @@ impl<'a> CommentQuery<'a> {
// This does not work for comment trees, and the limit should be manually set to a high number
//
// If a max depth is given, then you know its a tree fetch, and limits should be ignored
(i64::MAX, 0)
// TODO a kludge to prevent attacks. Limit comments to 300 for now.
// (i64::MAX, 0)
(300, 0)
} else {
limit_and_offset_unlimited(self.page, self.limit)
// limit_and_offset_unlimited(self.page, self.limit)
limit_and_offset(self.page, self.limit)?
};

query = match self.sort.unwrap_or(CommentSortType::Hot) {
Expand Down