From: Dessalines Date: Thu, 3 Sep 2020 13:48:26 +0000 (-0500) Subject: Fixing user search leaking emails. X-Git-Url: http://these/git/README.ja.md?a=commitdiff_plain;h=4a4629763ed8a88d14bd24ab53b30d80228e1e2b;p=lemmy.git Fixing user search leaking emails. --- diff --git a/server/lemmy_db/src/user_view.rs b/server/lemmy_db/src/user_view.rs index 08f4c79c..09a17aee 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 a18cc2d8..8ab7f599 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' && (
- @ {
- @