use crate::{
activities::{generate_activity_id, send_lemmy_activity, verify_person_in_community},
- insert_activity,
+ insert_received_activity,
objects::{community::ApubCommunity, person::ApubPerson},
protocol::{activities::community::report::Report, InCommunity},
PostOrComment,
comment::{CommentReportResponse, CreateCommentReport},
context::LemmyContext,
post::{CreatePostReport, PostReportResponse},
- utils::local_user_view_from_jwt,
+ utils::{local_user_view_from_jwt, sanitize_html},
};
use lemmy_db_schema::{
source::{
#[tracing::instrument(skip_all)]
async fn verify(&self, context: &Data<Self::DataType>) -> Result<(), LemmyError> {
+ insert_received_activity(&self.id, context).await?;
let community = self.community(context).await?;
verify_person_in_community(&self.actor, &community, context).await?;
Ok(())
#[tracing::instrument(skip_all)]
async fn receive(self, context: &Data<Self::DataType>) -> Result<(), LemmyError> {
- insert_activity(&self.id, &self, false, true, context).await?;
let actor = self.actor.dereference(context).await?;
match self.object.dereference(context).await? {
PostOrComment::Post(post) => {
post_id: post.id,
original_post_name: post.name.clone(),
original_post_url: post.url.clone(),
- reason: self.summary,
+ reason: sanitize_html(&self.summary),
original_post_body: post.body.clone(),
};
- PostReport::report(context.pool(), &report_form).await?;
+ PostReport::report(&mut context.pool(), &report_form).await?;
}
PostOrComment::Comment(comment) => {
let report_form = CommentReportForm {
creator_id: actor.id,
comment_id: comment.id,
original_comment_text: comment.content.clone(),
- reason: self.summary,
+ reason: sanitize_html(&self.summary),
};
- CommentReport::report(context.pool(), &report_form).await?;
+ CommentReport::report(&mut context.pool(), &report_form).await?;
}
};
Ok(())