mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-10 06:54:12 +00:00
parent
3c358e5b0b
commit
65da4e7dbd
7 changed files with 26 additions and 1 deletions
|
@ -55,10 +55,15 @@ pub async fn get_mod_log(
|
|||
data.mod_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 {
|
||||
community_id,
|
||||
mod_person_id,
|
||||
other_person_id,
|
||||
post_id,
|
||||
comment_id,
|
||||
page: data.page,
|
||||
limit: data.limit,
|
||||
hide_modlog_names,
|
||||
|
|
|
@ -118,6 +118,8 @@ pub struct GetModlog {
|
|||
pub limit: Option<i64>,
|
||||
pub type_: Option<ModlogActionType>,
|
||||
pub other_person_id: Option<PersonId>,
|
||||
pub post_id: Option<PostId>,
|
||||
pub comment_id: Option<CommentId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
|
|
|
@ -51,6 +51,10 @@ impl ModFeaturePostView {
|
|||
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)?;
|
||||
|
||||
query
|
||||
|
|
|
@ -52,6 +52,10 @@ impl ModLockPostView {
|
|||
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)?;
|
||||
|
||||
query
|
||||
|
|
|
@ -54,6 +54,10 @@ impl ModRemoveCommentView {
|
|||
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)?;
|
||||
|
||||
query
|
||||
|
|
|
@ -52,6 +52,10 @@ impl ModRemovePostView {
|
|||
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)?;
|
||||
|
||||
query
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#[cfg(feature = "full")]
|
||||
use diesel::Queryable;
|
||||
use lemmy_db_schema::{
|
||||
newtypes::{CommunityId, PersonId},
|
||||
newtypes::{CommentId, CommunityId, PersonId, PostId},
|
||||
source::{
|
||||
comment::Comment,
|
||||
community::Community,
|
||||
|
@ -228,6 +228,8 @@ pub struct ModlogListParams {
|
|||
pub community_id: Option<CommunityId>,
|
||||
pub mod_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 limit: Option<i64>,
|
||||
pub hide_modlog_names: bool,
|
||||
|
|
Loading…
Reference in a new issue