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

Fix contradicting filters. #5281

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 3 additions & 5 deletions crates/apub/src/api/list_comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use actix_web::web::{Json, Query};
use lemmy_api_common::{
comment::{GetComments, GetCommentsResponse},
context::LemmyContext,
utils::check_private_instance,
utils::{check_conflicting_like_filters, check_private_instance},
};
use lemmy_db_schema::{
source::{comment::Comment, community::Community},
Expand All @@ -19,7 +19,7 @@ use lemmy_db_views::{
comment_view::CommentQuery,
structs::{LocalUserView, SiteView},
};
use lemmy_utils::error::{LemmyError, LemmyErrorExt, LemmyErrorType, LemmyResult};
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};

#[tracing::instrument(skip(context))]
pub async fn list_comments(
Expand Down Expand Up @@ -50,9 +50,7 @@ pub async fn list_comments(

let liked_only = data.liked_only;
let disliked_only = data.disliked_only;
if liked_only.unwrap_or_default() && disliked_only.unwrap_or_default() {
return Err(LemmyError::from(LemmyErrorType::ContradictingFilters));
}
check_conflicting_like_filters(liked_only, disliked_only)?;

let page = data.page;
let limit = data.limit;
Expand Down