diff --git a/packages/backend-rs/src/misc/check_hit_antenna.rs b/packages/backend-rs/src/misc/check_hit_antenna.rs index 2b70f0ae8c..2f6befc739 100644 --- a/packages/backend-rs/src/misc/check_hit_antenna.rs +++ b/packages/backend-rs/src/misc/check_hit_antenna.rs @@ -72,14 +72,17 @@ pub async fn check_hit_antenna( // "Home", "Group", "List" sources are currently disabled - let note_texts = all_texts(NoteLike { - file_ids: note.file_ids, - user_id: note.user_id.clone(), - text: note.text, - cw: note.cw, - renote_id: note.renote_id, - reply_id: note.reply_id, - }) + let note_texts = all_texts( + NoteLike { + file_ids: note.file_ids, + user_id: note.user_id.clone(), + text: note.text, + cw: note.cw, + renote_id: note.renote_id, + reply_id: note.reply_id, + }, + false, + ) .await?; let has_keyword = antenna.keywords.iter().any(|words| { diff --git a/packages/backend-rs/src/misc/check_word_mute.rs b/packages/backend-rs/src/misc/check_word_mute.rs index 7796daf798..aba792baa5 100644 --- a/packages/backend-rs/src/misc/check_word_mute.rs +++ b/packages/backend-rs/src/misc/check_word_mute.rs @@ -36,7 +36,7 @@ pub async fn check_word_mute( Ok(false) } else { Ok(check_word_mute_impl( - &all_texts(note).await?, + &all_texts(note, true).await?, muted_words, muted_patterns, )) diff --git a/packages/backend-rs/src/misc/get_note_all_texts.rs b/packages/backend-rs/src/misc/get_note_all_texts.rs index 3625b3e8b4..12afe6d679 100644 --- a/packages/backend-rs/src/misc/get_note_all_texts.rs +++ b/packages/backend-rs/src/misc/get_note_all_texts.rs @@ -13,7 +13,7 @@ pub struct NoteLike { pub reply_id: Option, } -pub async fn all_texts(note: NoteLike) -> Result, DbErr> { +pub async fn all_texts(note: NoteLike, include_in_reply_to: bool) -> Result, DbErr> { let db = db_conn().await?; let mut texts: Vec = vec![]; @@ -56,8 +56,8 @@ pub async fn all_texts(note: NoteLike) -> Result, DbErr> { } } - if let Some(reply_id) = ¬e.reply_id { - if let Some((text, cw)) = note::Entity::find_by_id(reply_id) + if include_in_reply_to && note.reply_id.is_some() { + if let Some((text, cw)) = note::Entity::find_by_id(note.reply_id.as_ref().unwrap()) .select_only() .columns([note::Column::Text, note::Column::Cw]) .into_tuple::<(Option, Option)>() @@ -71,7 +71,7 @@ pub async fn all_texts(note: NoteLike) -> Result, DbErr> { texts.push(c); } } else { - tracing::warn!("nonexistent reply id: {}", reply_id); + tracing::warn!("nonexistent reply id: {}", note.reply_id.unwrap()); } }