π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Move Space profile media updates into ente-space
Manav Rathi937d738e6c32
diff --git a/rust/bindings/wasm/space/src/space.rs b/rust/bindings/wasm/space/src/space.rsindex d719a85cd4..1e345bc75f 100644--- a/rust/bindings/wasm/space/src/space.rs+++ b/rust/bindings/wasm/space/src/space.rs@@ -882,22 +882,9 @@ impl SpaceAccountCtxHandle {profile: String,avatar_bytes: Vec<u8>,) -> Result<<UpdateSpaceProfileResponse as Tsify>::JsType, Error> {- let space_key = self- .inner- .resolve_owned_space_key(&space_id)- .await?- .ok_or_else(|| {- ente_space::Error::InvalidInput(format!(- "space {space_id} is not owned by the account"- ))- })?;- let avatar = self- .inner- .upload_avatar(&space_id, &space_key, &avatar_bytes)- .await?;UpdateSpaceProfileResponse::from(self.inner- .update_space_profile(&space_id, profile.as_bytes(), Some(avatar), false)+ .update_space_profile_with_avatar(&space_id, profile.as_bytes(), &avatar_bytes).await?,).into_js()@@ -911,29 +898,9 @@ impl SpaceAccountCtxHandle {profile: String,cover_bytes: Vec<u8>,) -> Result<<UpdateSpaceProfileResponse as Tsify>::JsType, Error> {- let space_key = self- .inner- .resolve_owned_space_key(&space_id)- .await?- .ok_or_else(|| {- ente_space::Error::InvalidInput(format!(- "space {space_id} is not owned by the account"- ))- })?;- let cover = self- .inner- .upload_cover(&space_id, &space_key, &cover_bytes)- .await?;UpdateSpaceProfileResponse::from(self.inner- .update_space_profile_assets(- &space_id,- profile.as_bytes(),- None,- Some(cover),- false,- false,- )+ .update_space_profile_with_cover(&space_id, profile.as_bytes(), &cover_bytes).await?,).into_js()diff --git a/rust/crates/space/src/client/profiles.rs b/rust/crates/space/src/client/profiles.rsindex 42b0761fb0..2aec1d38f0 100644--- a/rust/crates/space/src/client/profiles.rs+++ b/rust/crates/space/src/client/profiles.rs@@ -106,6 +106,42 @@ impl AccountSpaceCtx {.await}+ pub async fn update_space_profile_with_avatar(+ &self,+ space_id: &str,+ profile: &[u8],+ avatar_bytes: &[u8],+ ) -> Result<UpdateSpaceProfileResponse> {+ let space_key = self+ .resolve_owned_space_key(space_id)+ .await?+ .ok_or_else(|| {+ Error::InvalidInput(format!("space {space_id} is not owned by the account"))+ })?;+ let avatar = self+ .upload_avatar(space_id, &space_key, avatar_bytes)+ .await?;+ self.update_space_profile(space_id, profile, Some(avatar), false)+ .await+ }++ pub async fn update_space_profile_with_cover(+ &self,+ space_id: &str,+ profile: &[u8],+ cover_bytes: &[u8],+ ) -> Result<UpdateSpaceProfileResponse> {+ let space_key = self+ .resolve_owned_space_key(space_id)+ .await?+ .ok_or_else(|| {+ Error::InvalidInput(format!("space {space_id} is not owned by the account"))+ })?;+ let cover = self.upload_cover(space_id, &space_key, cover_bytes).await?;+ self.update_space_profile_assets(space_id, profile, None, Some(cover), false, false)+ .await+ }+pub async fn update_space_profile_assets(&self,space_id: &str,