- let apub_id = person.id.inner().to_owned();
- let instance = blocking(context.pool(), move |conn| {
- Instance::create_from_actor_id(conn, &apub_id)
- })
- .await??;
+ let instance_id = fetch_instance_actor_for_object(&person.id, context).await?;
+
+ let name = sanitize_html(&person.preferred_username);
+ let display_name = sanitize_html_opt(&person.name);
+ let bio = read_from_string_or_source_opt(&person.summary, &None, &person.source);
+ let bio = sanitize_html_opt(&bio);
+
+ // Some Mastodon users have `name: ""` (empty string), need to convert that to `None`
+ // https://github.com/mastodon/mastodon/issues/25233
+ let display_name = display_name.filter(|n| !n.is_empty());