]> Untitled Git - lemmy.git/commitdiff
Fixing local filter, fixes #1181 (#1182)
authorDessalines <dessalines@users.noreply.github.com>
Thu, 8 Oct 2020 15:10:10 +0000 (11:10 -0400)
committerGitHub <noreply@github.com>
Thu, 8 Oct 2020 15:10:10 +0000 (11:10 -0400)
lemmy_db/src/community.rs
lemmy_db/src/user.rs

index f733a4d6f58d89db0b5036c2a2076fc913749c1f..733f63a15c451db3c0fe2b5d7eee3d40b54a4e6f 100644 (file)
@@ -87,7 +87,7 @@ impl Community {
   pub fn read_from_name(conn: &PgConnection, community_name: &str) -> Result<Self, Error> {
     use crate::schema::community::dsl::*;
     community
-      .filter(local)
+      .filter(local.eq(true))
       .filter(name.eq(community_name))
       .first::<Self>(conn)
   }
index 1f0a42ffb921d03b41b75a02d9740d3bb8610428..db8a999eb7d709bb2f2c06b86622e2da441e481c 100644 (file)
@@ -112,7 +112,10 @@ impl User_ {
   }
 
   pub fn read_from_name(conn: &PgConnection, from_user_name: &str) -> Result<Self, Error> {
-    user_.filter(name.eq(from_user_name)).first::<Self>(conn)
+    user_
+      .filter(local.eq(true))
+      .filter(name.eq(from_user_name))
+      .first::<Self>(conn)
   }
 
   pub fn add_admin(conn: &PgConnection, user_id: i32, added: bool) -> Result<Self, Error> {
@@ -145,14 +148,14 @@ impl User_ {
 
   pub fn find_by_username(conn: &PgConnection, username: &str) -> Result<User_, Error> {
     user_
-      .filter(local)
+      .filter(local.eq(true))
       .filter(name.ilike(username))
       .first::<User_>(conn)
   }
 
   pub fn find_by_email(conn: &PgConnection, from_email: &str) -> Result<User_, Error> {
     user_
-      .filter(local)
+      .filter(local.eq(true))
       .filter(email.eq(from_email))
       .first::<User_>(conn)
   }