diff options
Diffstat (limited to 'internal/timeline/manager.go')
-rw-r--r-- | internal/timeline/manager.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/internal/timeline/manager.go b/internal/timeline/manager.go index d50c9f783..00d87bb26 100644 --- a/internal/timeline/manager.go +++ b/internal/timeline/manager.go @@ -78,6 +78,8 @@ type Manager interface { Remove(statusID string, timelineAccountID string) (int, error) // WipeStatusFromAllTimelines removes one status from the index and prepared posts of all timelines WipeStatusFromAllTimelines(statusID string) error + // WipeStatusesFromAccountID removes all statuses by the given accountID from the timelineAccountID's timelines. + WipeStatusesFromAccountID(accountID string, timelineAccountID string) error } // NewManager returns a new timeline manager with the given database, typeconverter, config, and log. @@ -112,7 +114,7 @@ func (m *manager) Ingest(status *gtsmodel.Status, timelineAccountID string) (boo } l.Trace("ingesting status") - return t.IndexOne(status.CreatedAt, status.ID, status.BoostOfID) + return t.IndexOne(status.CreatedAt, status.ID, status.BoostOfID, status.AccountID, status.BoostOfAccountID) } func (m *manager) IngestAndPrepare(status *gtsmodel.Status, timelineAccountID string) (bool, error) { @@ -128,7 +130,7 @@ func (m *manager) IngestAndPrepare(status *gtsmodel.Status, timelineAccountID st } l.Trace("ingesting status") - return t.IndexAndPrepareOne(status.CreatedAt, status.ID) + return t.IndexAndPrepareOne(status.CreatedAt, status.ID, status.BoostOfID, status.AccountID, status.BoostOfAccountID) } func (m *manager) Remove(statusID string, timelineAccountID string) (int, error) { @@ -219,6 +221,16 @@ func (m *manager) WipeStatusFromAllTimelines(statusID string) error { return err } +func (m *manager) WipeStatusesFromAccountID(accountID string, timelineAccountID string) error { + t, err := m.getOrCreateTimeline(timelineAccountID) + if err != nil { + return err + } + + _, err = t.RemoveAllBy(accountID) + return err +} + func (m *manager) getOrCreateTimeline(timelineAccountID string) (Timeline, error) { var t Timeline i, ok := m.accountTimelines.Load(timelineAccountID) |