Introduce HttpClient trait, use it to fetch avatars in UserStore

* Add a FakeHttpClient for tests
This commit is contained in:
Max Brunsfeld
2021-09-14 13:42:44 -07:00
parent f0019e3725
commit 84d4bb6186
9 changed files with 146 additions and 54 deletions
+8 -2
View File
@@ -956,8 +956,14 @@ impl Workspace {
fn render_current_user(&self, cx: &mut RenderContext<Self>) -> ElementBox {
let theme = &self.settings.borrow().theme;
let avatar = if let Some(current_user) = self.user_store.current_user().borrow().as_ref() {
todo!()
let avatar = if let Some(avatar) = self
.user_store
.current_user()
.borrow()
.as_ref()
.and_then(|user| user.avatar.clone())
{
Image::new(avatar).boxed()
} else {
Svg::new("icons/signed-out-12.svg")
.with_color(theme.workspace.titlebar.icon_signed_out)