summaryrefslogtreecommitdiff
path: root/internal/timeline/timeline.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-06-23 18:42:20 +0200
committerLibravatar GitHub <noreply@github.com>2021-06-23 18:42:20 +0200
commit16e486ad96be2c81405f22229dcf58600e08e96d (patch)
tree819ca6cec771cc5f6dd7bbcd8e8e5c7234fc9b56 /internal/timeline/timeline.go
parentInstance settings updates (#59) (diff)
downloadgotosocial-16e486ad96be2c81405f22229dcf58600e08e96d.tar.xz
Timeline bugfix (#60)
* fix a stack overflow in the timeline * go fmt
Diffstat (limited to 'internal/timeline/timeline.go')
-rw-r--r--internal/timeline/timeline.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/timeline/timeline.go b/internal/timeline/timeline.go
index 5e274b572..d0fadb19e 100644
--- a/internal/timeline/timeline.go
+++ b/internal/timeline/timeline.go
@@ -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 {