Minor cleanup on reports PR
This commit is contained in:
parent
f070b1823d
commit
68173914ca
4 changed files with 4 additions and 3 deletions
|
@ -107,7 +107,7 @@ pub(crate) async fn check_community_ban(
|
||||||
/// * `user_id` - the user id of the moderator
|
/// * `user_id` - the user id of the moderator
|
||||||
/// * `community_id` - optional community id to check for moderator privileges
|
/// * `community_id` - optional community id to check for moderator privileges
|
||||||
/// * `pool` - the diesel db pool
|
/// * `pool` - the diesel db pool
|
||||||
pub(in crate) async fn collect_moderated_communities(
|
pub(crate) async fn collect_moderated_communities(
|
||||||
user_id: i32,
|
user_id: i32,
|
||||||
community_id: Option<i32>,
|
community_id: Option<i32>,
|
||||||
pool: &DbPool,
|
pool: &DbPool,
|
||||||
|
|
|
@ -166,7 +166,7 @@ impl CommentReportView {
|
||||||
/// returns the current unresolved comment report count for the supplied community ids
|
/// returns the current unresolved comment report count for the supplied community ids
|
||||||
///
|
///
|
||||||
/// * `community_ids` - a Vec<i32> of community_ids to get a count for
|
/// * `community_ids` - a Vec<i32> of community_ids to get a count for
|
||||||
pub fn get_report_count(conn: &PgConnection, community_ids: &Vec<i32>) -> Result<i64, Error> {
|
pub fn get_report_count(conn: &PgConnection, community_ids: &[i32]) -> Result<i64, Error> {
|
||||||
use super::comment_report::comment_report_view::dsl::*;
|
use super::comment_report::comment_report_view::dsl::*;
|
||||||
comment_report_view
|
comment_report_view
|
||||||
.filter(resolved.eq(false).and(community_id.eq_any(community_ids)))
|
.filter(resolved.eq(false).and(community_id.eq_any(community_ids)))
|
||||||
|
|
|
@ -167,7 +167,7 @@ impl PostReportView {
|
||||||
/// returns the current unresolved post report count for the supplied community ids
|
/// returns the current unresolved post report count for the supplied community ids
|
||||||
///
|
///
|
||||||
/// * `community_ids` - a Vec<i32> of community_ids to get a count for
|
/// * `community_ids` - a Vec<i32> of community_ids to get a count for
|
||||||
pub fn get_report_count(conn: &PgConnection, community_ids: &Vec<i32>) -> Result<i64, Error> {
|
pub fn get_report_count(conn: &PgConnection, community_ids: &[i32]) -> Result<i64, Error> {
|
||||||
use super::post_report::post_report_view::dsl::*;
|
use super::post_report::post_report_view::dsl::*;
|
||||||
post_report_view
|
post_report_view
|
||||||
.filter(resolved.eq(false).and(community_id.eq_any(community_ids)))
|
.filter(resolved.eq(false).and(community_id.eq_any(community_ids)))
|
||||||
|
|
|
@ -106,6 +106,7 @@ pub struct ResolveCommentReportResponse {
|
||||||
pub struct ListCommentReports {
|
pub struct ListCommentReports {
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
|
/// if no community is given, it returns reports for all communities moderated by the auth user
|
||||||
pub community: Option<i32>,
|
pub community: Option<i32>,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue