fix: fetch_actor_urls_from_collection follows 'first' page link like outbox does
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Has been cancelled
test / unit (pull_request) Has been cancelled
test / integration (pull_request) Has been cancelled
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Has been cancelled
test / unit (pull_request) Has been cancelled
test / integration (pull_request) Has been cancelled
This commit is contained in:
@@ -1622,7 +1622,8 @@ impl domain::ports::FederationActionPort for ActivityPubService {
|
|||||||
&self,
|
&self,
|
||||||
collection_url: &str,
|
collection_url: &str,
|
||||||
) -> Result<Vec<String>, domain::errors::DomainError> {
|
) -> Result<Vec<String>, domain::errors::DomainError> {
|
||||||
let resp: serde_json::Value = reqwest::Client::new()
|
let client = reqwest::Client::new();
|
||||||
|
let base: serde_json::Value = client
|
||||||
.get(collection_url)
|
.get(collection_url)
|
||||||
.header("Accept", "application/activity+json, application/ld+json")
|
.header("Accept", "application/activity+json, application/ld+json")
|
||||||
.send()
|
.send()
|
||||||
@@ -1632,8 +1633,27 @@ impl domain::ports::FederationActionPort for ActivityPubService {
|
|||||||
.await
|
.await
|
||||||
.map_err(|e| domain::errors::DomainError::ExternalService(e.to_string()))?;
|
.map_err(|e| domain::errors::DomainError::ExternalService(e.to_string()))?;
|
||||||
|
|
||||||
|
// Base collections typically have no orderedItems — follow the `first` page link.
|
||||||
|
let page = if base["orderedItems"].is_null() {
|
||||||
|
if let Some(first_url) = base["first"].as_str() {
|
||||||
|
client
|
||||||
|
.get(first_url)
|
||||||
|
.header("Accept", "application/activity+json, application/ld+json")
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.map_err(|e| domain::errors::DomainError::ExternalService(e.to_string()))?
|
||||||
|
.json()
|
||||||
|
.await
|
||||||
|
.map_err(|e| domain::errors::DomainError::ExternalService(e.to_string()))?
|
||||||
|
} else {
|
||||||
|
base
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
base
|
||||||
|
};
|
||||||
|
|
||||||
let empty = vec![];
|
let empty = vec![];
|
||||||
let items = resp["orderedItems"].as_array().unwrap_or(&empty);
|
let items = page["orderedItems"].as_array().unwrap_or(&empty);
|
||||||
Ok(items
|
Ok(items
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|v| v.as_str().map(|s| s.to_string()))
|
.filter_map(|v| v.as_str().map(|s| s.to_string()))
|
||||||
|
|||||||
Reference in New Issue
Block a user