Fixing local filter, fixes #1181 (#1182)

This commit is contained in:
Dessalines 2020-10-08 11:10:10 -04:00 committed by GitHub
parent 299598f0c4
commit f5184ce749
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View 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)
}

View 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)
}