diff options
Diffstat (limited to 'internal/db/pg/pg.go')
-rw-r--r-- | internal/db/pg/pg.go | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/internal/db/pg/pg.go b/internal/db/pg/pg.go index 614968e22..ad75cef15 100644 --- a/internal/db/pg/pg.go +++ b/internal/db/pg/pg.go @@ -814,92 +814,6 @@ func (ps *postgresService) WhoBoostedStatus(status *gtsmodel.Status) ([]*gtsmode return accounts, nil } -func (ps *postgresService) GetStatusesWhereFollowing(accountID string, maxID string, sinceID string, minID string, limit int, local bool) ([]*gtsmodel.Status, error) { - statuses := []*gtsmodel.Status{} - - q := ps.conn.Model(&statuses) - - q = q.ColumnExpr("status.*"). - Join("JOIN follows AS f ON f.target_account_id = status.account_id"). - Where("f.account_id = ?", accountID). - Order("status.id DESC") - - if maxID != "" { - q = q.Where("status.id < ?", maxID) - } - - if sinceID != "" { - q = q.Where("status.id > ?", sinceID) - } - - if minID != "" { - q = q.Where("status.id > ?", minID) - } - - if local { - q = q.Where("status.local = ?", local) - } - - if limit > 0 { - q = q.Limit(limit) - } - - err := q.Select() - if err != nil { - if err == pg.ErrNoRows { - return nil, db.ErrNoEntries{} - } - return nil, err - } - - if len(statuses) == 0 { - return nil, db.ErrNoEntries{} - } - - return statuses, nil -} - -func (ps *postgresService) GetPublicTimelineForAccount(accountID string, maxID string, sinceID string, minID string, limit int, local bool) ([]*gtsmodel.Status, error) { - statuses := []*gtsmodel.Status{} - - q := ps.conn.Model(&statuses). - Where("visibility = ?", gtsmodel.VisibilityPublic). - Where("? IS NULL", pg.Ident("in_reply_to_id")). - Where("? IS NULL", pg.Ident("in_reply_to_uri")). - Where("? IS NULL", pg.Ident("boost_of_id")). - Order("status.id DESC") - - if maxID != "" { - q = q.Where("status.id < ?", maxID) - } - - if sinceID != "" { - q = q.Where("status.id > ?", sinceID) - } - - if minID != "" { - q = q.Where("status.id > ?", minID) - } - - if local { - q = q.Where("status.local = ?", local) - } - - if limit > 0 { - q = q.Limit(limit) - } - - err := q.Select() - if err != nil { - if err == pg.ErrNoRows { - return nil, db.ErrNoEntries{} - } - return nil, err - } - - return statuses, nil -} - func (ps *postgresService) GetNotificationsForAccount(accountID string, limit int, maxID string, sinceID string) ([]*gtsmodel.Notification, error) { notifications := []*gtsmodel.Notification{} |