Ignore known parents

This commit is contained in:
ekzyis 2024-09-26 19:54:38 +02:00
parent f3cd10cbb8
commit cec8aaf274
1 changed files with 13 additions and 0 deletions

View File

@ -53,6 +53,19 @@ func ItemHasReply(parentId int, userId int) (bool, error) {
return true, err
}
if count > 0 {
return true, nil
}
// check if parent already exists, this means we ignored it
if err = db.QueryRow(`SELECT COUNT(1) FROM items WHERE id = ?`, parentId).Scan(&count); err != nil {
return true, err
}
if count > 0 {
log.Printf("ignoring known item %d", parentId)
}
return count > 0, nil
}