Profiles: make server outbox optional
This commit is contained in:
parent
1305af196b
commit
7fc61d0e26
|
@ -36,7 +36,7 @@ pub(crate) fn application(
|
||||||
}
|
}
|
||||||
|
|
||||||
let inbox = application.inbox()?.clone();
|
let inbox = application.inbox()?.clone();
|
||||||
let outbox = application.outbox()?.req("outbox")?.clone();
|
let outbox = application.outbox()?.map(|o| o.to_owned());
|
||||||
let following = application.following()?.map(|f| f.to_owned());
|
let following = application.following()?.map(|f| f.to_owned());
|
||||||
let followers = application.followers()?.map(|f| f.to_owned());
|
let followers = application.followers()?.map(|f| f.to_owned());
|
||||||
let shared_inbox = application
|
let shared_inbox = application
|
||||||
|
@ -141,7 +141,7 @@ pub(crate) fn update_application(
|
||||||
let server_id = server_id.server().req("application id as server id")?;
|
let server_id = server_id.server().req("application id as server id")?;
|
||||||
|
|
||||||
let inbox = application.inbox()?.clone();
|
let inbox = application.inbox()?.clone();
|
||||||
let outbox = application.outbox()?.req("outbox")?.clone();
|
let outbox = application.outbox()?.map(|o| o.to_owned());
|
||||||
let following = application.following()?.map(|f| f.to_owned());
|
let following = application.following()?.map(|f| f.to_owned());
|
||||||
let followers = application.followers()?.map(|f| f.to_owned());
|
let followers = application.followers()?.map(|f| f.to_owned());
|
||||||
let shared_inbox = application
|
let shared_inbox = application
|
||||||
|
|
|
@ -74,7 +74,7 @@ pub(crate) fn person(
|
||||||
}
|
}
|
||||||
|
|
||||||
let inbox = person.inbox()?.clone();
|
let inbox = person.inbox()?.clone();
|
||||||
let outbox = person.outbox()?.req("outbox")?.clone();
|
let outbox = person.outbox()?.map(|o| o.to_owned());
|
||||||
let following = person.following()?.map(|f| f.to_owned());
|
let following = person.following()?.map(|f| f.to_owned());
|
||||||
let followers = person.followers()?.map(|f| f.to_owned());
|
let followers = person.followers()?.map(|f| f.to_owned());
|
||||||
let shared_inbox = person
|
let shared_inbox = person
|
||||||
|
@ -203,7 +203,7 @@ pub(crate) fn update_person(
|
||||||
}
|
}
|
||||||
|
|
||||||
let inbox = person.inbox()?.clone();
|
let inbox = person.inbox()?.clone();
|
||||||
let outbox = person.outbox()?.req("outbox")?.clone();
|
let outbox = person.outbox()?.map(|o| o.to_owned());
|
||||||
let following = person.following()?.map(|f| f.to_owned());
|
let following = person.following()?.map(|f| f.to_owned());
|
||||||
let followers = person.followers()?.map(|f| f.to_owned());
|
let followers = person.followers()?.map(|f| f.to_owned());
|
||||||
let shared_inbox = person
|
let shared_inbox = person
|
||||||
|
|
|
@ -180,7 +180,7 @@ struct Keys {
|
||||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
struct Endpoints {
|
struct Endpoints {
|
||||||
inbox: Url,
|
inbox: Url,
|
||||||
outbox: Url,
|
outbox: Option<Url>,
|
||||||
following: Option<Url>,
|
following: Option<Url>,
|
||||||
followers: Option<Url>,
|
followers: Option<Url>,
|
||||||
shared_inbox: Option<Url>,
|
shared_inbox: Option<Url>,
|
||||||
|
|
|
@ -99,7 +99,7 @@ impl Outbound for ProfileCreated {
|
||||||
&person_id,
|
&person_id,
|
||||||
crate::apub::Endpoints {
|
crate::apub::Endpoints {
|
||||||
inbox: inbox.clone(),
|
inbox: inbox.clone(),
|
||||||
outbox: outbox.clone(),
|
outbox: Some(outbox.clone()),
|
||||||
following: Some(following.clone()),
|
following: Some(following.clone()),
|
||||||
followers: Some(followers.clone()),
|
followers: Some(followers.clone()),
|
||||||
shared_inbox: Some(shared_inbox.clone()),
|
shared_inbox: Some(shared_inbox.clone()),
|
||||||
|
@ -232,10 +232,12 @@ impl Outbound for ProfileUpdated {
|
||||||
|
|
||||||
person
|
person
|
||||||
.set_id(person_id.clone())
|
.set_id(person_id.clone())
|
||||||
.set_outbox(endpoints.outbox)
|
|
||||||
.set_preferred_username(profile.handle())
|
.set_preferred_username(profile.handle())
|
||||||
.set_published(profile.published().into());
|
.set_published(profile.published().into());
|
||||||
|
|
||||||
|
if let Some(outbox) = endpoints.outbox {
|
||||||
|
person.set_outbox(outbox);
|
||||||
|
}
|
||||||
if let Some(following) = endpoints.following {
|
if let Some(following) = endpoints.following {
|
||||||
person.set_following(following);
|
person.set_following(following);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ impl Outbound for ServerCreated {
|
||||||
&application_id,
|
&application_id,
|
||||||
crate::apub::Endpoints {
|
crate::apub::Endpoints {
|
||||||
inbox: inbox.clone(),
|
inbox: inbox.clone(),
|
||||||
outbox: outbox.clone(),
|
outbox: Some(outbox.clone()),
|
||||||
following: Some(following.clone()),
|
following: Some(following.clone()),
|
||||||
followers: Some(followers.clone()),
|
followers: Some(followers.clone()),
|
||||||
shared_inbox: Some(shared_inbox.clone()),
|
shared_inbox: Some(shared_inbox.clone()),
|
||||||
|
@ -187,10 +187,12 @@ impl Outbound for ServerUpdated {
|
||||||
|
|
||||||
application
|
application
|
||||||
.set_id(application_id.clone())
|
.set_id(application_id.clone())
|
||||||
.set_outbox(endpoints.outbox)
|
|
||||||
.set_preferred_username(server.domain())
|
.set_preferred_username(server.domain())
|
||||||
.set_published(server.created().into());
|
.set_published(server.created().into());
|
||||||
|
|
||||||
|
if let Some(outbox) = endpoints.outbox {
|
||||||
|
application.set_outbox(outbox);
|
||||||
|
}
|
||||||
if let Some(following) = endpoints.following {
|
if let Some(following) = endpoints.following {
|
||||||
application.set_following(following);
|
application.set_following(following);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue