forked from alemi/upub
fix: only fetch remote objects to avoid recursion
This commit is contained in:
parent
3a79ca05a2
commit
93b5c0cd4a
3 changed files with 3 additions and 3 deletions
|
@ -39,7 +39,7 @@ pub async fn view(
|
||||||
.await?
|
.await?
|
||||||
{
|
{
|
||||||
Some(activity) => Ok(JsonLD(serde_json::Value::from(activity).ld_context())),
|
Some(activity) => Ok(JsonLD(serde_json::Value::from(activity).ld_context())),
|
||||||
None => if auth.is_local() && query.fetch {
|
None => if auth.is_local() && query.fetch && !ctx.is_local(&aid) {
|
||||||
Ok(JsonLD(ap_activity(ctx.fetch().activity(&aid).await?).ld_context()))
|
Ok(JsonLD(ap_activity(ctx.fetch().activity(&aid).await?).ld_context()))
|
||||||
} else {
|
} else {
|
||||||
Err(UpubError::not_found())
|
Err(UpubError::not_found())
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub async fn view(
|
||||||
{
|
{
|
||||||
Some(EmbeddedActivity { activity: _, object: Some(object) }) => Ok(JsonLD(ap_object(object).ld_context())),
|
Some(EmbeddedActivity { activity: _, object: Some(object) }) => Ok(JsonLD(ap_object(object).ld_context())),
|
||||||
Some(EmbeddedActivity { activity: _, object: None }) => Err(UpubError::not_found()),
|
Some(EmbeddedActivity { activity: _, object: None }) => Err(UpubError::not_found()),
|
||||||
None => if auth.is_local() && query.fetch {
|
None => if auth.is_local() && query.fetch && !ctx.is_local(&oid) {
|
||||||
Ok(JsonLD(ap_object(ctx.fetch().object(&oid).await?).ld_context()))
|
Ok(JsonLD(ap_object(ctx.fetch().object(&oid).await?).ld_context()))
|
||||||
} else {
|
} else {
|
||||||
Err(UpubError::not_found())
|
Err(UpubError::not_found())
|
||||||
|
|
|
@ -102,7 +102,7 @@ pub async fn view(
|
||||||
},
|
},
|
||||||
// remote user TODDO doesn't work?
|
// remote user TODDO doesn't work?
|
||||||
Some((user, None)) => Ok(JsonLD(ap_user(user).ld_context())),
|
Some((user, None)) => Ok(JsonLD(ap_user(user).ld_context())),
|
||||||
None => if auth.is_local() && query.fetch {
|
None => if auth.is_local() && query.fetch && !ctx.is_local(&uid) {
|
||||||
Ok(JsonLD(ap_user(ctx.fetch().user(&uid).await?).ld_context()))
|
Ok(JsonLD(ap_user(ctx.fetch().user(&uid).await?).ld_context()))
|
||||||
} else {
|
} else {
|
||||||
Err(UpubError::not_found())
|
Err(UpubError::not_found())
|
||||||
|
|
Loading…
Reference in a new issue