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
|
// "Home", "Group", "List" sources are currently disabled
|
||||||
|
|
||||||
let note_texts = all_texts(NoteLike {
|
let note_texts = all_texts(
|
||||||
file_ids: note.file_ids,
|
NoteLike {
|
||||||
user_id: note.user_id.clone(),
|
file_ids: note.file_ids,
|
||||||
text: note.text,
|
user_id: note.user_id.clone(),
|
||||||
cw: note.cw,
|
text: note.text,
|
||||||
renote_id: note.renote_id,
|
cw: note.cw,
|
||||||
reply_id: note.reply_id,
|
renote_id: note.renote_id,
|
||||||
})
|
reply_id: note.reply_id,
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let has_keyword = antenna.keywords.iter().any(|words| {
|
let has_keyword = antenna.keywords.iter().any(|words| {
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub async fn check_word_mute(
|
||||||
Ok(false)
|
Ok(false)
|
||||||
} else {
|
} else {
|
||||||
Ok(check_word_mute_impl(
|
Ok(check_word_mute_impl(
|
||||||
&all_texts(note).await?,
|
&all_texts(note, true).await?,
|
||||||
muted_words,
|
muted_words,
|
||||||
muted_patterns,
|
muted_patterns,
|
||||||
))
|
))
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub struct NoteLike {
|
||||||
pub reply_id: Option<String>,
|
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 db = db_conn().await?;
|
||||||
|
|
||||||
let mut texts: Vec<String> = vec![];
|
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 include_in_reply_to && note.reply_id.is_some() {
|
||||||
if let Some((text, cw)) = note::Entity::find_by_id(reply_id)
|
if let Some((text, cw)) = note::Entity::find_by_id(note.reply_id.as_ref().unwrap())
|
||||||
.select_only()
|
.select_only()
|
||||||
.columns([note::Column::Text, note::Column::Cw])
|
.columns([note::Column::Text, note::Column::Cw])
|
||||||
.into_tuple::<(Option<String>, Option<String>)>()
|
.into_tuple::<(Option<String>, Option<String>)>()
|
||||||
|
@ -71,7 +71,7 @@ pub async fn all_texts(note: NoteLike) -> Result<Vec<String>, DbErr> {
|
||||||
texts.push(c);
|
texts.push(c);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tracing::warn!("nonexistent reply id: {}", reply_id);
|
tracing::warn!("nonexistent reply id: {}", note.reply_id.unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue