From 4a4629763ed8a88d14bd24ab53b30d80228e1e2b Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 3 Sep 2020 08:48:26 -0500 Subject: [PATCH] Fixing user search leaking emails. --- server/lemmy_db/src/user_view.rs | 23 +++++++++++++++++++++++ ui/src/components/search.tsx | 3 +-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/server/lemmy_db/src/user_view.rs b/server/lemmy_db/src/user_view.rs index 08f4c79cf..09a17aee3 100644 --- a/server/lemmy_db/src/user_view.rs +++ b/server/lemmy_db/src/user_view.rs @@ -125,6 +125,7 @@ impl<'a> UserQueryBuilder<'a> { pub fn list(self) -> Result, Error> { use super::user_view::user_fast::dsl::*; + use diesel::sql_types::{Nullable, Text}; let mut query = self.query; @@ -154,6 +155,28 @@ impl<'a> UserQueryBuilder<'a> { let (limit, offset) = limit_and_offset(self.page, self.limit); query = query.limit(limit).offset(offset); + // The select is necessary here to not get back emails + query = query.select(( + id, + actor_id, + name, + preferred_username, + avatar, + banner, + "".into_sql::>(), + matrix_user_id, + bio, + local, + admin, + banned, + show_avatars, + send_notifications_to_email, + published, + number_of_posts, + post_score, + number_of_comments, + comment_score, + )); query.load::(self.conn) } } diff --git a/ui/src/components/search.tsx b/ui/src/components/search.tsx index a18cc2d8e..8ab7f599b 100644 --- a/ui/src/components/search.tsx +++ b/ui/src/components/search.tsx @@ -311,7 +311,6 @@ export class Search extends Component { {i.type_ == 'users' && (
- @ {
- @