Addressing PR comments.

auto_resolve_reports_1
Dessalines 2024-02-14 11:12:28 -05:00
parent 3ec4478193
commit 380f227204
3 changed files with 4 additions and 2 deletions

View File

@ -44,7 +44,6 @@ pub async fn create_post_report(
)
.await?;
// Don't allow creating reports for removed / deleted posts
check_post_deleted_or_removed(&post_view.post)?;
let report_form = PostReportForm {

View File

@ -225,6 +225,7 @@ pub async fn check_community_mod_action(
Ok(())
}
/// Don't allow creating reports for removed / deleted posts
pub fn check_post_deleted_or_removed(post: &Post) -> Result<(), LemmyError> {
if post.deleted || post.removed {
Err(LemmyErrorType::Deleted)?

View File

@ -14,7 +14,7 @@ use activitypub_federation::{
kinds::activity::FlagType,
traits::{ActivityHandler, Actor},
};
use lemmy_api_common::context::LemmyContext;
use lemmy_api_common::{context::LemmyContext, utils::check_post_deleted_or_removed};
use lemmy_db_schema::{
source::{
activity::ActivitySendTargets,
@ -104,6 +104,8 @@ impl ActivityHandler for Report {
let reason = self.reason()?;
match self.object.dereference(context).await? {
PostOrComment::Post(post) => {
check_post_deleted_or_removed(&post)?;
let report_form = PostReportForm {
creator_id: actor.id,
post_id: post.id,