diff --git a/src/activitypub/handlers/move.rs b/src/activitypub/handlers/move.rs index 5731501..544104a 100644 --- a/src/activitypub/handlers/move.rs +++ b/src/activitypub/handlers/move.rs @@ -10,7 +10,6 @@ use crate::activitypub::{ }, fetcher::helpers::get_or_import_profile_by_actor_id, identifiers::{parse_local_actor_id, profile_actor_id}, - receiver::parse_array, vocabulary::PERSON, }; use crate::database::{DatabaseClient, DatabaseError}; @@ -80,13 +79,8 @@ pub async fn handle_move( .into_iter() .map(|profile| profile_actor_id(&instance.url(), &profile)) .collect::>(); - // Read aliases from alsoKnownAs property - // TODO: use new_profile.aliases.into_actor_ids() - if let Some(ref value) = new_actor.also_known_as { - let also_known_as = parse_array(value) - .map_err(|_| ValidationError("invalid alias list"))?; - aliases.extend(also_known_as); - }; + // Add aliases reported by server (actor's alsoKnownAs property) + aliases.extend(new_profile.aliases.into_actor_ids()); if !aliases.contains(&old_actor_id) { return Err(ValidationError("target ID is not an alias").into()); }; diff --git a/src/models/profiles/types.rs b/src/models/profiles/types.rs index 10a5716..0acc0ed 100644 --- a/src/models/profiles/types.rs +++ b/src/models/profiles/types.rs @@ -547,4 +547,13 @@ mod tests { let serialized = serde_json::to_string(&payment_option).unwrap(); assert_eq!(serialized, r#"{"payment_type":2,"chain_id":"eip155:1"}"#); } + + #[test] + fn test_alias() { + let actor_id = "https://example.com/users/alice"; + let aliases = Aliases::new(vec![actor_id.to_string()]); + let actor_ids = aliases.into_actor_ids(); + assert_eq!(actor_ids.len(), 1); + assert_eq!(actor_ids[0], actor_id); + } }