comment::{CommentReportResponse, CreateCommentReport},
context::LemmyContext,
post::{CreatePostReport, PostReportResponse},
- utils::get_local_user_view_from_jwt,
- websocket::UserOperation,
+ utils::local_user_view_from_jwt,
};
use lemmy_db_schema::{
source::{
},
traits::Reportable,
};
-use lemmy_db_views::structs::{CommentReportView, PostReportView};
use lemmy_utils::error::LemmyError;
use url::Url;
response: &Self::Response,
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
- let local_user_view =
- get_local_user_view_from_jwt(&request.auth, context.pool(), context.secret()).await?;
+ let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
Report::send(
ObjectId::from(response.post_report_view.post.ap_id.clone()),
&local_user_view.person.into(),
response: &Self::Response,
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
- let local_user_view =
- get_local_user_view_from_jwt(&request.auth, context.pool(), context.secret()).await?;
+ let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
Report::send(
ObjectId::from(response.comment_report_view.comment.ap_id.clone()),
&local_user_view.person.into(),
reason: self.summary,
original_post_body: post.body.clone(),
};
-
- let report = PostReport::report(context.pool(), &report_form).await?;
-
- let post_report_view = PostReportView::read(context.pool(), report.id, actor.id).await?;
-
- context.send_mod_ws_message(
- &UserOperation::CreateCommentReport,
- &PostReportResponse { post_report_view },
- post.community_id,
- None,
- )?;
+ PostReport::report(&mut context.pool(), &report_form).await?;
}
PostOrComment::Comment(comment) => {
let report_form = CommentReportForm {
original_comment_text: comment.content.clone(),
reason: self.summary,
};
-
- let report = CommentReport::report(context.pool(), &report_form).await?;
-
- let comment_report_view =
- CommentReportView::read(context.pool(), report.id, actor.id).await?;
- let community_id = comment_report_view.community.id;
-
- context.send_mod_ws_message(
- &UserOperation::CreateCommentReport,
- &CommentReportResponse {
- comment_report_view,
- },
- community_id,
- None,
- )?;
+ CommentReport::report(&mut context.pool(), &report_form).await?;
}
};
Ok(())