From: Felix Ableitner Date: Thu, 26 Nov 2020 12:28:58 +0000 (+0100) Subject: Minor cleanup on reports PR X-Git-Url: http://these/git/%7B%60%24%7BarchiveTodayUrl%7D/static/readmes/README.ru.md?a=commitdiff_plain;h=68173914ca2ff3af6ef717be52edd230b3729c77;p=lemmy.git Minor cleanup on reports PR --- diff --git a/lemmy_api/src/lib.rs b/lemmy_api/src/lib.rs index 1f678e62..06b629c7 100644 --- a/lemmy_api/src/lib.rs +++ b/lemmy_api/src/lib.rs @@ -107,7 +107,7 @@ pub(crate) async fn check_community_ban( /// * `user_id` - the user id of the moderator /// * `community_id` - optional community id to check for moderator privileges /// * `pool` - the diesel db pool -pub(in crate) async fn collect_moderated_communities( +pub(crate) async fn collect_moderated_communities( user_id: i32, community_id: Option, pool: &DbPool, diff --git a/lemmy_db/src/comment_report.rs b/lemmy_db/src/comment_report.rs index b1037f11..a243891e 100644 --- a/lemmy_db/src/comment_report.rs +++ b/lemmy_db/src/comment_report.rs @@ -166,7 +166,7 @@ impl CommentReportView { /// returns the current unresolved comment report count for the supplied community ids /// /// * `community_ids` - a Vec of community_ids to get a count for - pub fn get_report_count(conn: &PgConnection, community_ids: &Vec) -> Result { + pub fn get_report_count(conn: &PgConnection, community_ids: &[i32]) -> Result { use super::comment_report::comment_report_view::dsl::*; comment_report_view .filter(resolved.eq(false).and(community_id.eq_any(community_ids))) diff --git a/lemmy_db/src/post_report.rs b/lemmy_db/src/post_report.rs index 3422f54a..5f8aa5ea 100644 --- a/lemmy_db/src/post_report.rs +++ b/lemmy_db/src/post_report.rs @@ -167,7 +167,7 @@ impl PostReportView { /// returns the current unresolved post report count for the supplied community ids /// /// * `community_ids` - a Vec of community_ids to get a count for - pub fn get_report_count(conn: &PgConnection, community_ids: &Vec) -> Result { + pub fn get_report_count(conn: &PgConnection, community_ids: &[i32]) -> Result { use super::post_report::post_report_view::dsl::*; post_report_view .filter(resolved.eq(false).and(community_id.eq_any(community_ids))) diff --git a/lemmy_structs/src/comment.rs b/lemmy_structs/src/comment.rs index ed292cae..6479124f 100644 --- a/lemmy_structs/src/comment.rs +++ b/lemmy_structs/src/comment.rs @@ -106,6 +106,7 @@ pub struct ResolveCommentReportResponse { pub struct ListCommentReports { pub page: Option, pub limit: Option, + /// if no community is given, it returns reports for all communities moderated by the auth user pub community: Option, pub auth: String, }