fix: fallback to current time for rich activity
This commit is contained in:
parent
660e5cf127
commit
0a98934a7e
1 changed files with 4 additions and 1 deletions
|
@ -44,10 +44,13 @@ impl FromQueryResult for RichActivity {
|
||||||
fn from_query_result(res: &QueryResult, _pre: &str) -> Result<Self, DbErr> {
|
fn from_query_result(res: &QueryResult, _pre: &str) -> Result<Self, DbErr> {
|
||||||
Ok(RichActivity {
|
Ok(RichActivity {
|
||||||
attachments: None, hashtags: None, mentions: None,
|
attachments: None, hashtags: None, mentions: None,
|
||||||
discovered: res.try_get(crate::model::addressing::Entity.table_name(), &crate::model::addressing::Column::Published.to_string())?,
|
|
||||||
liked: res.try_get(crate::model::like::Entity.table_name(), &crate::model::like::Column::Actor.to_string()).ok(),
|
liked: res.try_get(crate::model::like::Entity.table_name(), &crate::model::like::Column::Actor.to_string()).ok(),
|
||||||
object: crate::model::object::Model::from_query_result(res, crate::model::object::Entity.table_name()).ok(),
|
object: crate::model::object::Model::from_query_result(res, crate::model::object::Entity.table_name()).ok(),
|
||||||
activity: crate::model::activity::Model::from_query_result(res, crate::model::activity::Entity.table_name()).ok(),
|
activity: crate::model::activity::Model::from_query_result(res, crate::model::activity::Entity.table_name()).ok(),
|
||||||
|
discovered: res.try_get(
|
||||||
|
crate::model::addressing::Entity.table_name(),
|
||||||
|
&crate::model::addressing::Column::Published.to_string()
|
||||||
|
).unwrap_or(chrono::Utc::now()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue