Make name property optional on actor object

This commit is contained in:
silverpill 2021-12-20 00:12:18 +00:00
parent 93b703ba2f
commit 263fae8039
3 changed files with 6 additions and 5 deletions

View file

@ -60,7 +60,8 @@ pub struct Actor {
#[serde(rename = "type")] #[serde(rename = "type")]
object_type: String, object_type: String,
pub name: String, pub name: Option<String>,
pub preferred_username: String, pub preferred_username: String,
pub inbox: String, pub inbox: String,
pub outbox: String, pub outbox: String,
@ -200,7 +201,7 @@ pub fn get_local_actor(
])), ])),
id: actor_id.clone(), id: actor_id.clone(),
object_type: PERSON.to_string(), object_type: PERSON.to_string(),
name: username.to_string(), name: user.profile.display_name.clone(),
preferred_username: username.to_string(), preferred_username: username.to_string(),
inbox, inbox,
outbox, outbox,
@ -236,7 +237,7 @@ pub fn get_instance_actor(
])), ])),
id: actor_id, id: actor_id,
object_type: SERVICE.to_string(), object_type: SERVICE.to_string(),
name: instance.host(), name: Some(instance.host()),
preferred_username: instance.host(), preferred_username: instance.host(),
inbox: actor_inbox, inbox: actor_inbox,
outbox: actor_outbox, outbox: actor_outbox,

View file

@ -144,7 +144,7 @@ pub async fn fetch_profile_by_actor_id(
); );
let profile_data = ProfileCreateData { let profile_data = ProfileCreateData {
username: actor.preferred_username, username: actor.preferred_username,
display_name: Some(actor.name), display_name: actor.name,
acct: actor_address, acct: actor_address,
bio: actor.summary, bio: actor.summary,
avatar, avatar,

View file

@ -493,7 +493,7 @@ pub async fn receive_activity(
.map_err(|_| ValidationError("failed to fetch image"))?; .map_err(|_| ValidationError("failed to fetch image"))?;
let extra_fields = actor.extra_fields(); let extra_fields = actor.extra_fields();
let mut profile_data = ProfileUpdateData { let mut profile_data = ProfileUpdateData {
display_name: Some(actor.name), display_name: actor.name,
bio: actor.summary.clone(), bio: actor.summary.clone(),
bio_source: actor.summary, bio_source: actor.summary,
avatar, avatar,