]> Untitled Git - lemmy.git/commitdiff
Minor cleanup on reports PR
authorFelix Ableitner <me@nutomic.com>
Thu, 26 Nov 2020 12:28:58 +0000 (13:28 +0100)
committerFelix Ableitner <me@nutomic.com>
Thu, 26 Nov 2020 12:28:58 +0000 (13:28 +0100)
lemmy_api/src/lib.rs
lemmy_db/src/comment_report.rs
lemmy_db/src/post_report.rs
lemmy_structs/src/comment.rs

index 1f678e62c0ce3180506351f841c564d79131caba..06b629c772cd78e592c91ba802e67f603d93f46e 100644 (file)
@@ -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<i32>,
   pool: &DbPool,
index b1037f111ba0bcbc216c09e33bc8d18560ce9c58..a243891eb8d863ea9890db4c0157cbbb6cd29ce2 100644 (file)
@@ -166,7 +166,7 @@ impl CommentReportView {
   /// 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
-  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::*;
     comment_report_view
       .filter(resolved.eq(false).and(community_id.eq_any(community_ids)))
index 3422f54a5dff2ec6645fd86a2fcc1e2f159e5952..5f8aa5ea59f263468da145517a9a79d3860a29f2 100644 (file)
@@ -167,7 +167,7 @@ impl PostReportView {
   /// 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
-  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::*;
     post_report_view
       .filter(resolved.eq(false).and(community_id.eq_any(community_ids)))
index ed292caed4eb37b27937b3cef3da6e8205522960..6479124f8eca606ba290e1b6fcd53f0e08c4cd44 100644 (file)
@@ -106,6 +106,7 @@ pub struct ResolveCommentReportResponse {
 pub struct ListCommentReports {
   pub page: 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 auth: String,
 }