Avoid panics when encountering an invalid mention
This commit is contained in:
parent
67dd577a27
commit
cf23360c4a
@ -63,8 +63,8 @@ impl Mention {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_activity(conn: &PgConnection, ment: link::Mention, inside: i32, in_post: bool) -> Option<Self> {
|
pub fn from_activity(conn: &PgConnection, ment: link::Mention, inside: i32, in_post: bool) -> Option<Self> {
|
||||||
let ap_url = ment.link_props.href_string().unwrap();
|
let ap_url = ment.link_props.href_string().ok()?;
|
||||||
let mentioned = User::find_by_ap_url(conn, ap_url).unwrap();
|
let mentioned = User::find_by_ap_url(conn, ap_url)?;
|
||||||
|
|
||||||
if in_post {
|
if in_post {
|
||||||
Post::get(conn, inside.clone().into()).map(|post| {
|
Post::get(conn, inside.clone().into()).map(|post| {
|
||||||
|
Loading…
Reference in New Issue
Block a user