fix: duplicated posts in all timeline
This commit is contained in:
parent
1dc0611298
commit
e5b6b5a4d4
9 changed files with 34 additions and 43 deletions
|
@ -1374,6 +1374,7 @@ impl DataManager {
|
|||
batch: usize,
|
||||
page: usize,
|
||||
as_user: &Option<User>,
|
||||
before_time: usize,
|
||||
) -> Result<Vec<Post>> {
|
||||
let hide_answers: bool = if let Some(user) = as_user {
|
||||
user.settings.all_timeline_hide_answers
|
||||
|
@ -1389,7 +1390,12 @@ impl DataManager {
|
|||
let res = query_rows!(
|
||||
&conn,
|
||||
&format!(
|
||||
"SELECT * FROM posts WHERE replying_to = 0 AND NOT context LIKE '%\"is_nsfw\":true%'{} ORDER BY created DESC LIMIT $1 OFFSET $2",
|
||||
"SELECT * FROM posts WHERE replying_to = 0{} AND NOT context LIKE '%\"is_nsfw\":true%'{} ORDER BY created DESC LIMIT $1 OFFSET $2",
|
||||
if before_time > 0 {
|
||||
format!(" AND created < {before_time}")
|
||||
} else {
|
||||
String::new()
|
||||
},
|
||||
if hide_answers {
|
||||
" AND context::jsonb->>'answering' = '0'"
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue