mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 14:45:10 +00:00
parent
3c358e5b0b
commit
65da4e7dbd
|
@ -55,10 +55,15 @@ pub async fn get_mod_log(
|
||||||
data.mod_person_id
|
data.mod_person_id
|
||||||
};
|
};
|
||||||
let other_person_id = data.other_person_id;
|
let other_person_id = data.other_person_id;
|
||||||
|
let post_id = data.post_id;
|
||||||
|
let comment_id = data.comment_id;
|
||||||
|
|
||||||
let params = ModlogListParams {
|
let params = ModlogListParams {
|
||||||
community_id,
|
community_id,
|
||||||
mod_person_id,
|
mod_person_id,
|
||||||
other_person_id,
|
other_person_id,
|
||||||
|
post_id,
|
||||||
|
comment_id,
|
||||||
page: data.page,
|
page: data.page,
|
||||||
limit: data.limit,
|
limit: data.limit,
|
||||||
hide_modlog_names,
|
hide_modlog_names,
|
||||||
|
|
|
@ -118,6 +118,8 @@ pub struct GetModlog {
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
pub type_: Option<ModlogActionType>,
|
pub type_: Option<ModlogActionType>,
|
||||||
pub other_person_id: Option<PersonId>,
|
pub other_person_id: Option<PersonId>,
|
||||||
|
pub post_id: Option<PostId>,
|
||||||
|
pub comment_id: Option<CommentId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
|
|
@ -51,6 +51,10 @@ impl ModFeaturePostView {
|
||||||
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if let Some(post_id) = params.post_id {
|
||||||
|
query = query.filter(post::id.eq(post_id));
|
||||||
|
}
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
||||||
|
|
||||||
query
|
query
|
||||||
|
|
|
@ -52,6 +52,10 @@ impl ModLockPostView {
|
||||||
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if let Some(post_id) = params.post_id {
|
||||||
|
query = query.filter(post::id.eq(post_id));
|
||||||
|
}
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
||||||
|
|
||||||
query
|
query
|
||||||
|
|
|
@ -54,6 +54,10 @@ impl ModRemoveCommentView {
|
||||||
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if let Some(comment_id) = params.comment_id {
|
||||||
|
query = query.filter(comment::id.eq(comment_id));
|
||||||
|
}
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
||||||
|
|
||||||
query
|
query
|
||||||
|
|
|
@ -52,6 +52,10 @@ impl ModRemovePostView {
|
||||||
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
query = query.filter(person_alias_1.field(person::id).eq(other_person_id));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if let Some(post_id) = params.post_id {
|
||||||
|
query = query.filter(post::id.eq(post_id));
|
||||||
|
}
|
||||||
|
|
||||||
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
let (limit, offset) = limit_and_offset(params.page, params.limit)?;
|
||||||
|
|
||||||
query
|
query
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
use diesel::Queryable;
|
use diesel::Queryable;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
newtypes::{CommunityId, PersonId},
|
newtypes::{CommentId, CommunityId, PersonId, PostId},
|
||||||
source::{
|
source::{
|
||||||
comment::Comment,
|
comment::Comment,
|
||||||
community::Community,
|
community::Community,
|
||||||
|
@ -228,6 +228,8 @@ pub struct ModlogListParams {
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
pub mod_person_id: Option<PersonId>,
|
pub mod_person_id: Option<PersonId>,
|
||||||
pub other_person_id: Option<PersonId>,
|
pub other_person_id: Option<PersonId>,
|
||||||
|
pub post_id: Option<PostId>,
|
||||||
|
pub comment_id: Option<CommentId>,
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
pub hide_modlog_names: bool,
|
pub hide_modlog_names: bool,
|
||||||
|
|
Loading…
Reference in a new issue