Federate display name and summary

Fixes #9
This commit is contained in:
Bat 2018-05-03 16:34:16 +01:00
parent 08a21c7a04
commit b844257e34
3 changed files with 22 additions and 2 deletions

View File

@ -25,6 +25,10 @@ pub trait Actor: Sized {
fn get_actor_id(&self) -> String; fn get_actor_id(&self) -> String;
fn get_display_name(&self) -> String;
fn get_summary(&self) -> String;
fn get_instance(&self, conn: &PgConnection) -> Instance; fn get_instance(&self, conn: &PgConnection) -> Instance;
fn get_actor_type() -> ActorType; fn get_actor_type() -> ActorType;
@ -37,8 +41,8 @@ pub trait Actor: Sized {
"inbox": self.compute_inbox(conn), "inbox": self.compute_inbox(conn),
"outbox": self.compute_outbox(conn), "outbox": self.compute_outbox(conn),
"preferredUsername": self.get_actor_id(), "preferredUsername": self.get_actor_id(),
"name": "", "name": self.get_display_name(),
"summary": "", "summary": self.get_summary(),
"url": self.compute_id(conn), "url": self.compute_id(conn),
"endpoints": { "endpoints": {
"sharedInbox": ap_url(format!("{}/inbox", BASE_URL.as_str())) "sharedInbox": ap_url(format!("{}/inbox", BASE_URL.as_str()))

View File

@ -97,6 +97,14 @@ impl Actor for Blog {
self.actor_id.to_string() self.actor_id.to_string()
} }
fn get_display_name(&self) -> String {
self.title.clone()
}
fn get_summary(&self) -> String {
self.summary.clone()
}
fn get_instance(&self, conn: &PgConnection) -> Instance { fn get_instance(&self, conn: &PgConnection) -> Instance {
Instance::get(conn, self.instance_id).unwrap() Instance::get(conn, self.instance_id).unwrap()
} }

View File

@ -232,6 +232,14 @@ impl Actor for User {
self.username.to_string() self.username.to_string()
} }
fn get_display_name(&self) -> String {
self.display_name.clone()
}
fn get_summary(&self) -> String {
self.summary.clone()
}
fn get_instance(&self, conn: &PgConnection) -> Instance { fn get_instance(&self, conn: &PgConnection) -> Instance {
Instance::get(conn, self.instance_id).unwrap() Instance::get(conn, self.instance_id).unwrap()
} }