Skip to content

Commit

Permalink
chore: Provide default type in default pfp
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusc93 committed Oct 21, 2023
1 parent c7f79f7 commit 6fdac34
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
4 changes: 2 additions & 2 deletions extensions/warp-ipfs/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
str::FromStr,
time::Duration,
};
use warp::multipass::identity::Identity;
use warp::{multipass::identity::Identity, constellation::file::FileType};

#[derive(Default, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
Expand Down Expand Up @@ -250,7 +250,7 @@ pub enum UpdateEvents {
}

pub type DefaultPfpFn =
std::sync::Arc<dyn Fn(&Identity) -> Result<Vec<u8>, std::io::Error> + Send + Sync + 'static>;
std::sync::Arc<dyn Fn(&Identity) -> Result<(Vec<u8>, FileType), std::io::Error> + Send + Sync + 'static>;

#[derive(Clone, Serialize, Deserialize)]
pub struct StoreSetting {
Expand Down
14 changes: 2 additions & 12 deletions extensions/warp-ipfs/src/store/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1657,10 +1657,10 @@ impl IdentityStore {

if let Some(cb) = self.config.store_setting.default_profile_picture.as_deref() {
let identity = document.resolve()?;
let picture = cb(&identity)?;
let (picture, ty) = cb(&identity)?;
let mut image = IdentityImage::default();
image.set_data(picture);
image.set_image_type(FileType::Generic);
image.set_image_type(ty);

return Ok(image);
}
Expand Down Expand Up @@ -1690,16 +1690,6 @@ impl IdentityStore {
return Ok(data);
}

if let Some(cb) = self.config.store_setting.default_profile_picture.as_deref() {
let identity = document.resolve()?;
let picture = cb(&identity)?;
let mut image = IdentityImage::default();
image.set_data(picture);
image.set_image_type(FileType::Generic);

return Ok(image);
}

Err(Error::InvalidIdentityBanner)
}

Expand Down

0 comments on commit 6fdac34

Please sign in to comment.