fix (backend-rs): don't check in-reply-to post in antennas
This commit is contained in:
parent
f1e3395783
commit
d750af3d79
3 changed files with 16 additions and 13 deletions
|
@ -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| {
|
||||
|
|
|
@ -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,
|
||||
))
|
||||
|
|
|
@ -13,7 +13,7 @@ pub struct NoteLike {
|
|||
pub reply_id: Option<String>,
|
||||
}
|
||||
|
||||
pub async fn all_texts(note: NoteLike) -> Result<Vec<String>, DbErr> {
|
||||
pub async fn all_texts(note: NoteLike, include_in_reply_to: bool) -> Result<Vec<String>, DbErr> {
|
||||
let db = db_conn().await?;
|
||||
|
||||
let mut texts: Vec<String> = vec![];
|
||||
|
@ -56,8 +56,8 @@ pub async fn all_texts(note: NoteLike) -> Result<Vec<String>, 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<String>, Option<String>)>()
|
||||
|
@ -71,7 +71,7 @@ pub async fn all_texts(note: NoteLike) -> Result<Vec<String>, DbErr> {
|
|||
texts.push(c);
|
||||
}
|
||||
} else {
|
||||
tracing::warn!("nonexistent reply id: {}", reply_id);
|
||||
tracing::warn!("nonexistent reply id: {}", note.reply_id.unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue