]> Untitled Git - lemmy.git/blobdiff - crates/api/src/comment_report/list.rs
Make functions work with both connection and pool (#3420)
[lemmy.git] / crates / api / src / comment_report / list.rs
index 2cd9ca1bdff3bb434db3cfde004e318992aa3280..baa1bf45fee3112de801814c1ba6ebec6562c348 100644 (file)
@@ -6,7 +6,7 @@ use lemmy_api_common::{
   utils::local_user_view_from_jwt,
 };
 use lemmy_db_views::comment_report_view::CommentReportQuery;
-use lemmy_utils::{error::LemmyError, ConnectionId};
+use lemmy_utils::error::LemmyError;
 
 /// Lists comment reports for a community if an id is supplied
 /// or returns all comment reports for communities a user moderates
@@ -14,11 +14,10 @@ use lemmy_utils::{error::LemmyError, ConnectionId};
 impl Perform for ListCommentReports {
   type Response = ListCommentReportsResponse;
 
-  #[tracing::instrument(skip(context, _websocket_id))]
+  #[tracing::instrument(skip(context))]
   async fn perform(
     &self,
     context: &Data<LemmyContext>,
-    _websocket_id: Option<ConnectionId>,
   ) -> Result<ListCommentReportsResponse, LemmyError> {
     let data: &ListCommentReports = self;
     let local_user_view = local_user_view_from_jwt(&data.auth, context).await?;
@@ -31,7 +30,7 @@ impl Perform for ListCommentReports {
     let page = data.page;
     let limit = data.limit;
     let comment_reports = CommentReportQuery::builder()
-      .pool(context.pool())
+      .pool(&mut context.pool())
       .my_person_id(person_id)
       .admin(admin)
       .community_id(community_id)
@@ -42,8 +41,6 @@ impl Perform for ListCommentReports {
       .list()
       .await?;
 
-    let res = ListCommentReportsResponse { comment_reports };
-
-    Ok(res)
+    Ok(ListCommentReportsResponse { comment_reports })
   }
 }