From caa0795d07314fad50106ef07f47cccb9a6f4e92 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Sun, 14 Jul 2024 16:27:11 +0100 Subject: [PATCH] fix(core/database); never include relations on known users --- crates/core/database/src/util/bridge/v0.rs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/crates/core/database/src/util/bridge/v0.rs b/crates/core/database/src/util/bridge/v0.rs index 747857cd..87ec4ba1 100644 --- a/crates/core/database/src/util/bridge/v0.rs +++ b/crates/core/database/src/util/bridge/v0.rs @@ -1024,6 +1024,8 @@ impl crate::User { } /// Convert user object into user model assuming mutual connection + /// + /// Relations will never be included, i.e. when we process ourselves pub fn into_known<'a, P>(self, perspective: P, is_online: bool) -> User where P: Into>, @@ -1059,19 +1061,7 @@ impl crate::User { discriminator: self.discriminator, display_name: self.display_name, avatar: self.avatar.map(|file| file.into()), - relations: if let Some(crate::User { id, .. }) = perspective { - if id == &self.id { - self.relations - .unwrap_or_default() - .into_iter() - .map(|relation| relation.into()) - .collect() - } else { - vec![] - } - } else { - vec![] - }, + relations: vec![], badges: self.badges.unwrap_or_default() as u32, online: can_see_profile && is_online