server notified of client profile updates

This commit is contained in:
2026-08-07 15:10:20 +08:00
parent 151ff9e5c6
commit a561a6fe94
4 changed files with 123 additions and 20 deletions
+3
View File
@@ -1,5 +1,6 @@
use crate::db::{self, AppDatabase};
use crate::keypair::AppKeypair;
use crate::network::Network;
use crate::user::User;
use serde::{Deserialize, Serialize};
use specta::Type;
@@ -71,11 +72,13 @@ pub async fn update_profile(
handle: AppHandle,
database: State<'_, AppDatabase>,
keypair: State<'_, AppKeypair>,
network: State<'_, Network>,
display_name: String,
) -> Result<User, String> {
let profile = update(&database, keypair.public_key(), display_name)
.await
.map_err(db::command_error)?;
network.update_profile(profile.clone());
emit_changed(&handle, profile.clone())?;
Ok(profile)
}