making it AP complaint
Some checks failed
CI / Check / Test (push) Has been cancelled

This commit is contained in:
2026-06-30 02:25:42 +02:00
parent 943a0abe54
commit 5ae38c834a
66 changed files with 3635 additions and 2369 deletions

View File

@@ -0,0 +1,19 @@
use domain::{errors::DomainError, events::DomainEvent, value_objects::UserId};
use crate::users::deps::UpdateProfileDeps;
pub async fn execute(deps: &UpdateProfileDeps, user_id: uuid::Uuid) -> Result<(), DomainError> {
let uid = UserId::from_uuid(user_id);
deps.user
.find_by_id(&uid)
.await?
.ok_or_else(|| DomainError::NotFound("User not found".into()))?;
// Notify federation peers before any data is removed so they can process the tombstone.
deps.event_publisher
.publish(&DomainEvent::UserDeleted { user_id: uid })
.await?;
Ok(())
}

View File

@@ -1,4 +1,5 @@
pub mod commands;
pub mod delete_account;
pub mod deps;
pub mod get_current_profile;
pub mod get_profile;

View File

@@ -68,6 +68,14 @@ pub async fn execute(
user.banner_path().map(|s| s.to_string())
};
let moved_to = cmd.also_known_as.as_deref().and_then(|new_url| {
if user.also_known_as().map(|s| s != new_url).unwrap_or(true) {
Some(new_url.to_string())
} else {
None
}
});
deps.user
.update_profile(
&user_id,
@@ -83,9 +91,21 @@ pub async fn execute(
.await?;
deps.event_publisher
.publish(&DomainEvent::UserUpdated { user_id })
.publish(&DomainEvent::UserUpdated {
user_id: user_id.clone(),
})
.await?;
if let Some(new_actor_url) = moved_to {
let _ = deps
.event_publisher
.publish(&DomainEvent::UserAccountMoved {
user_id,
new_actor_url,
})
.await;
}
Ok(())
}