add: forum posts ui
This commit is contained in:
parent
ef029c59b3
commit
2be87c397d
90 changed files with 1459 additions and 1299 deletions
|
@ -132,6 +132,7 @@ impl DataManager {
|
|||
id: usize,
|
||||
batch: usize,
|
||||
page: usize,
|
||||
sort: &str,
|
||||
) -> Result<Vec<Post>> {
|
||||
let conn = match self.0.connect().await {
|
||||
Ok(c) => c,
|
||||
|
@ -140,7 +141,9 @@ impl DataManager {
|
|||
|
||||
let res = query_rows!(
|
||||
&conn,
|
||||
"SELECT * FROM posts WHERE replying_to = $1 ORDER BY created DESC LIMIT $2 OFFSET $3",
|
||||
&format!(
|
||||
"SELECT * FROM posts WHERE replying_to = $1 ORDER BY created {sort} LIMIT $2 OFFSET $3"
|
||||
),
|
||||
&[&(id as i64), &(batch as i64), &((page * batch) as i64)],
|
||||
|x| { Self::get_post_from_row(x) }
|
||||
);
|
||||
|
@ -1768,7 +1771,7 @@ impl DataManager {
|
|||
"Community does not allow titles".to_string(),
|
||||
));
|
||||
}
|
||||
} else {
|
||||
} else if data.replying_to.is_none() {
|
||||
if data.title.len() < 2 && community.context.require_titles {
|
||||
return Err(Error::DataTooShort("title".to_string()));
|
||||
} else if data.title.len() > 128 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue