mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-23 13:03:11 +00:00
parent
299598f0c4
commit
f5184ce749
2 changed files with 7 additions and 4 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue