mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-08 03:01:59 +00:00
Fix contradicting filters. (#5281)
This commit is contained in:
parent
c034229295
commit
c656465e28
1 changed files with 3 additions and 5 deletions
|
@ -9,7 +9,7 @@ use actix_web::web::{Json, Query};
|
||||||
use lemmy_api_common::{
|
use lemmy_api_common::{
|
||||||
comment::{GetComments, GetCommentsResponse},
|
comment::{GetComments, GetCommentsResponse},
|
||||||
context::LemmyContext,
|
context::LemmyContext,
|
||||||
utils::check_private_instance,
|
utils::{check_conflicting_like_filters, check_private_instance},
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
source::{comment::Comment, community::Community},
|
source::{comment::Comment, community::Community},
|
||||||
|
@ -19,7 +19,7 @@ use lemmy_db_views::{
|
||||||
comment_view::CommentQuery,
|
comment_view::CommentQuery,
|
||||||
structs::{LocalUserView, SiteView},
|
structs::{LocalUserView, SiteView},
|
||||||
};
|
};
|
||||||
use lemmy_utils::error::{LemmyError, LemmyErrorExt, LemmyErrorType, LemmyResult};
|
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||||
|
|
||||||
#[tracing::instrument(skip(context))]
|
#[tracing::instrument(skip(context))]
|
||||||
pub async fn list_comments(
|
pub async fn list_comments(
|
||||||
|
@ -50,9 +50,7 @@ pub async fn list_comments(
|
||||||
|
|
||||||
let liked_only = data.liked_only;
|
let liked_only = data.liked_only;
|
||||||
let disliked_only = data.disliked_only;
|
let disliked_only = data.disliked_only;
|
||||||
if liked_only.unwrap_or_default() && disliked_only.unwrap_or_default() {
|
check_conflicting_like_filters(liked_only, disliked_only)?;
|
||||||
return Err(LemmyError::from(LemmyErrorType::ContradictingFilters));
|
|
||||||
}
|
|
||||||
|
|
||||||
let page = data.page;
|
let page = data.page;
|
||||||
let limit = data.limit;
|
let limit = data.limit;
|
||||||
|
|
Loading…
Reference in a new issue