export function randomString(length: number): string {
var result = '';
- var characters = 'abcdefghijklmnopqrstuvwxyz0123456789_';
+ var characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_';
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
documentation = "https://join-lemmy.org/docs/en/index.html"
[lib]
+name = "lemmy_db_schema"
+path = "src/lib.rs"
doctest = false
[dependencies]
use crate::{
+ functions::lower,
naive_now,
newtypes::{CommunityId, DbUrl, PersonId},
source::community::{
use crate::schema::community::dsl::*;
community
.filter(local.eq(true))
- .filter(name.eq(community_name))
+ .filter(lower(name).eq(lower(community_name)))
.first::<Self>(conn)
}
use crate::{
+ functions::lower,
naive_now,
newtypes::{DbUrl, PersonId},
schema::person::dsl::*,
person
.filter(deleted.eq(false))
.filter(local.eq(true))
- .filter(name.eq(from_name))
+ .filter(lower(name).eq(lower(from_name)))
.first::<Person>(conn)
}
sql_function! {
fn hot_rank(score: BigInt, time: Timestamp) -> Integer;
}
+
+ sql_function!(fn lower(x: Text) -> Text);
}
#[cfg(test)]
Lazy::new(|| RwLock::new(Settings::init().expect("Failed to load settings file")));
static WEBFINGER_REGEX: Lazy<Regex> = Lazy::new(|| {
Regex::new(&format!(
- "^acct:([a-z0-9_]{{3,}})@{}$",
+ "^acct:([a-zA-Z0-9_]{{3,}})@{}$",
Settings::get().hostname
))
.expect("compile webfinger regex")