From f5184ce7498d8ef4832e1ad15aa66add3676d0b9 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 8 Oct 2020 11:10:10 -0400 Subject: [PATCH] Fixing local filter, fixes #1181 (#1182) --- lemmy_db/src/community.rs | 2 +- lemmy_db/src/user.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lemmy_db/src/community.rs b/lemmy_db/src/community.rs index f733a4d6f..733f63a15 100644 --- a/lemmy_db/src/community.rs +++ b/lemmy_db/src/community.rs @@ -87,7 +87,7 @@ impl Community { pub fn read_from_name(conn: &PgConnection, community_name: &str) -> Result { use crate::schema::community::dsl::*; community - .filter(local) + .filter(local.eq(true)) .filter(name.eq(community_name)) .first::(conn) } diff --git a/lemmy_db/src/user.rs b/lemmy_db/src/user.rs index 1f0a42ffb..db8a999eb 100644 --- a/lemmy_db/src/user.rs +++ b/lemmy_db/src/user.rs @@ -112,7 +112,10 @@ impl User_ { } pub fn read_from_name(conn: &PgConnection, from_user_name: &str) -> Result { - user_.filter(name.eq(from_user_name)).first::(conn) + user_ + .filter(local.eq(true)) + .filter(name.eq(from_user_name)) + .first::(conn) } pub fn add_admin(conn: &PgConnection, user_id: i32, added: bool) -> Result { @@ -145,14 +148,14 @@ impl User_ { pub fn find_by_username(conn: &PgConnection, username: &str) -> Result { user_ - .filter(local) + .filter(local.eq(true)) .filter(name.ilike(username)) .first::(conn) } pub fn find_by_email(conn: &PgConnection, from_email: &str) -> Result { user_ - .filter(local) + .filter(local.eq(true)) .filter(email.eq(from_email)) .first::(conn) }