Timeline bugfix (#60)

* fix a stack overflow in the timeline

* go fmt
This commit is contained in:
Tobi Smethurst 2021-06-23 18:42:20 +02:00 committed by GitHub
commit 16e486ad96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 100 additions and 26 deletions

View file

@ -125,16 +125,22 @@ type timeline struct {
}
// NewTimeline returns a new Timeline for the given account ID
func NewTimeline(accountID string, db db.DB, typeConverter typeutils.TypeConverter, log *logrus.Logger) Timeline {
func NewTimeline(accountID string, db db.DB, typeConverter typeutils.TypeConverter, log *logrus.Logger) (Timeline, error) {
timelineOwnerAccount := &gtsmodel.Account{}
if err := db.GetByID(accountID, timelineOwnerAccount); err != nil {
return nil, err
}
return &timeline{
postIndex: &postIndex{},
preparedPosts: &preparedPosts{},
accountID: accountID,
account: timelineOwnerAccount,
db: db,
filter: visibility.NewFilter(db, log),
tc: typeConverter,
log: log,
}
}, nil
}
func (t *timeline) Reset() error {