From: Dessalines Date: Thu, 8 Oct 2020 15:10:10 +0000 (-0400) Subject: Fixing local filter, fixes #1181 (#1182) X-Git-Url: http://these/git/readmes/%7B%60%24%7BarchiveTodayUrl%7D/static/git-favicon.png?a=commitdiff_plain;h=f5184ce7498d8ef4832e1ad15aa66add3676d0b9;p=lemmy.git Fixing local filter, fixes #1181 (#1182) --- diff --git a/lemmy_db/src/community.rs b/lemmy_db/src/community.rs index f733a4d6..733f63a1 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 1f0a42ff..db8a999e 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) }