fix(ap): resolve parent ap_id for replies so inReplyTo is set on outbound Notes
This commit is contained in:
@@ -48,6 +48,29 @@ impl FederationEventService {
|
|||||||
Some(u) => u,
|
Some(u) => u,
|
||||||
None => return Ok(()),
|
None => return Ok(()),
|
||||||
};
|
};
|
||||||
|
// For replies to remote posts: in_reply_to_url is None but in_reply_to_id
|
||||||
|
// points to the locally-stored remote thought. Resolve its ap_id so the
|
||||||
|
// outbound Note includes inReplyTo and Mastodon threads it correctly.
|
||||||
|
let thought = if thought.in_reply_to_url.is_none() {
|
||||||
|
if let Some(ref reply_id) = thought.in_reply_to_id {
|
||||||
|
match self.thoughts.find_by_id(reply_id).await? {
|
||||||
|
Some(parent) => {
|
||||||
|
let parent_ap_url = parent.ap_id.unwrap_or_else(|| {
|
||||||
|
format!("{}/thoughts/{}", self.base_url, reply_id)
|
||||||
|
});
|
||||||
|
domain::models::thought::Thought {
|
||||||
|
in_reply_to_url: Some(parent_ap_url),
|
||||||
|
..thought
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => thought,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
thought
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
thought
|
||||||
|
};
|
||||||
self.ap
|
self.ap
|
||||||
.broadcast_create(user_id, &thought, user.username.as_str())
|
.broadcast_create(user_id, &thought, user.username.as_str())
|
||||||
.await
|
.await
|
||||||
|
|||||||
Reference in New Issue
Block a user