fix: don't show replies in main timelines

fix: add ui debounce
fix: make usernames case insensitive
This commit is contained in:
trisua 2025-04-03 16:47:48 -04:00
parent 9f4e8a4d25
commit 8a9394a06a
6 changed files with 14 additions and 8 deletions

View file

@ -76,11 +76,13 @@ impl DataManager {
///
/// # Arguments
/// * `data` - a mock [`User`] object to insert
pub async fn create_user(&self, data: User) -> Result<()> {
pub async fn create_user(&self, mut data: User) -> Result<()> {
if self.0.security.registration_enabled == false {
return Err(Error::RegistrationDisabled);
}
data.username = data.username.to_lowercase();
// check values
if data.username.len() < 2 {
return Err(Error::DataTooShort("username".to_string()));

View file

@ -223,7 +223,7 @@ impl DataManager {
let res = query_rows!(
&conn,
"SELECT * FROM posts ORDER BY likes DESC, created ASC LIMIT $1 OFFSET $2",
"SELECT * FROM posts WHERE replying_to = 0 ORDER BY likes DESC, created ASC LIMIT $1 OFFSET $2",
&[&(batch as i64), &((page * batch) as i64)],
|x| { Self::get_post_from_row(x) }
);
@ -268,7 +268,7 @@ impl DataManager {
let res = query_rows!(
&conn,
&format!(
"SELECT * FROM posts WHERE community = {} {query_string} ORDER BY created DESC LIMIT $1 OFFSET $2",
"SELECT * FROM posts WHERE (community = {} {query_string}) AND replying_to = 0 ORDER BY created DESC LIMIT $1 OFFSET $2",
first.community
),
&[&(batch as i64), &((page * batch) as i64)],
@ -423,7 +423,7 @@ impl DataManager {
// send notification
if data.owner != rt.owner {
let owner = self.get_user_by_id(rt.owner).await?;
let owner = self.get_user_by_id(data.owner).await?;
self.create_notification(Notification::new(
"Your post has received a new comment!".to_string(),
format!(