From e18c31999af71f6dfd611cc373341675e95f2e9a Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Wed, 5 Jul 2023 12:39:01 -0700 Subject: [PATCH] Fix session user avatar display --- src/models/user/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/models/user/mod.rs b/src/models/user/mod.rs index 61014cd..25432d4 100644 --- a/src/models/user/mod.rs +++ b/src/models/user/mod.rs @@ -129,7 +129,9 @@ impl SessionUser { USER_DISCRIMINATOR_COOKIE, user.discriminator.to_string(), )); - cookies.add_private(Cookie::new(USER_AVATAR_COOKIE, user.avatar())); + if let Some(avatar) = &user.avatar { + cookies.add_private(Cookie::new(USER_AVATAR_COOKIE, avatar.clone())); + } Ok(Self(user)) } @@ -147,7 +149,7 @@ impl SessionUser { id: parse_cookie_value(cookies, USER_ID_COOKIE)?, name: parse_cookie_value(cookies, USER_NAME_COOKIE)?, discriminator: parse_cookie_value(cookies, USER_DISCRIMINATOR_COOKIE)?, - avatar: Some(parse_cookie_value(cookies, USER_AVATAR_COOKIE)?), + avatar: parse_cookie_value(cookies, USER_AVATAR_COOKIE), deleted: false, })) }