fix (backend-rs): selected texts may be None in check_word_mute
Co-authored-by: naskya <m@naskya.net>
This commit is contained in:
parent
603ec70b97
commit
99b8a40566
|
@ -31,21 +31,27 @@ async fn all_texts(note: NoteLike) -> Result<Vec<String>, DbErr> {
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(drive_file::Column::Comment)
|
.column(drive_file::Column::Comment)
|
||||||
.filter(drive_file::Column::Id.is_in(note.file_ids))
|
.filter(drive_file::Column::Id.is_in(note.file_ids))
|
||||||
.into_tuple::<String>()
|
.into_tuple::<Option<String>>()
|
||||||
.all(db)
|
.all(db)
|
||||||
.await?,
|
.await?
|
||||||
|
.into_iter()
|
||||||
|
.flatten(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(renote_id) = note.renote_id {
|
if let Some(renote_id) = note.renote_id {
|
||||||
if let Some((text, cw)) = note::Entity::find_by_id(renote_id)
|
if let Some((text, cw)) = note::Entity::find_by_id(renote_id)
|
||||||
.select_only()
|
.select_only()
|
||||||
.columns([note::Column::Text, note::Column::Cw])
|
.columns([note::Column::Text, note::Column::Cw])
|
||||||
.into_tuple::<(String, String)>()
|
.into_tuple::<(Option<String>, Option<String>)>()
|
||||||
.one(db)
|
.one(db)
|
||||||
.await?
|
.await?
|
||||||
{
|
{
|
||||||
texts.push(text);
|
if let Some(t) = text {
|
||||||
texts.push(cw);
|
texts.push(t);
|
||||||
|
}
|
||||||
|
if let Some(c) = cw {
|
||||||
|
texts.push(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,12 +59,16 @@ async fn all_texts(note: NoteLike) -> Result<Vec<String>, DbErr> {
|
||||||
if let Some((text, cw)) = note::Entity::find_by_id(reply_id)
|
if let Some((text, cw)) = note::Entity::find_by_id(reply_id)
|
||||||
.select_only()
|
.select_only()
|
||||||
.columns([note::Column::Text, note::Column::Cw])
|
.columns([note::Column::Text, note::Column::Cw])
|
||||||
.into_tuple::<(String, String)>()
|
.into_tuple::<(Option<String>, Option<String>)>()
|
||||||
.one(db)
|
.one(db)
|
||||||
.await?
|
.await?
|
||||||
{
|
{
|
||||||
texts.push(text);
|
if let Some(t) = text {
|
||||||
texts.push(cw);
|
texts.push(t);
|
||||||
|
}
|
||||||
|
if let Some(c) = cw {
|
||||||
|
texts.push(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue