fix: duplicated posts in all timeline
This commit is contained in:
parent
1dc0611298
commit
e5b6b5a4d4
9 changed files with 34 additions and 43 deletions
|
@ -725,14 +725,16 @@ impl DataManager {
|
|||
self.cache_clear_user(&other_user).await;
|
||||
|
||||
// create audit log entry
|
||||
self.create_audit_log_entry(AuditLogEntry::new(
|
||||
user.id,
|
||||
format!(
|
||||
"invoked `update_user_purchased_status` with x value `{}` and y value `{}`",
|
||||
other_user.id, x
|
||||
),
|
||||
))
|
||||
.await?;
|
||||
if user.id != other_user.id {
|
||||
self.create_audit_log_entry(AuditLogEntry::new(
|
||||
user.id,
|
||||
format!(
|
||||
"invoked `update_user_purchased_status` with x value `{}` and y value `{}`",
|
||||
other_user.id, x
|
||||
),
|
||||
))
|
||||
.await?;
|
||||
}
|
||||
|
||||
// ...
|
||||
Ok(())
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -56,7 +56,7 @@ impl DataManager {
|
|||
match stack.sort {
|
||||
StackSort::Created => {
|
||||
self.fill_posts_with_community(
|
||||
self.get_latest_posts(batch, page, &user).await?,
|
||||
self.get_latest_posts(batch, page, &user, 0).await?,
|
||||
as_user_id,
|
||||
&ignore_users,
|
||||
user,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue