From de1e46a053603616b4e30b4e007872240634a4fe Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 22 Dec 2024 18:14:59 -0500 Subject: [PATCH] Fix contradicting filters. --- crates/apub/src/api/list_comments.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/apub/src/api/list_comments.rs b/crates/apub/src/api/list_comments.rs index 3e7a2f4ebe..05195b3afa 100644 --- a/crates/apub/src/api/list_comments.rs +++ b/crates/apub/src/api/list_comments.rs @@ -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}, @@ -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( @@ -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;