diff options
author | 2021-06-21 15:56:00 +0200 | |
---|---|---|
committer | 2021-06-21 15:56:00 +0200 | |
commit | a5fd6f427bab2cac03b4da5668eed18b900ba3be (patch) | |
tree | 5456928a707656a54cddcffb1199f59a4bc9039e /internal/timeline | |
parent | Testrig fixes (#50) (diff) | |
download | gotosocial-a5fd6f427bab2cac03b4da5668eed18b900ba3be.tar.xz |
Deletes+unboosts (#52)
* Status deletes properly streamed now.
* Unboosts now work locally and federated.
* Documentation updates.
Diffstat (limited to 'internal/timeline')
-rw-r--r-- | internal/timeline/manager.go | 16 | ||||
-rw-r--r-- | internal/timeline/remove.go | 10 |
2 files changed, 14 insertions, 12 deletions
diff --git a/internal/timeline/manager.go b/internal/timeline/manager.go index 2770f9e96..923fd010b 100644 --- a/internal/timeline/manager.go +++ b/internal/timeline/manager.go @@ -74,11 +74,9 @@ type Manager interface { GetOldestIndexedID(timelineAccountID string) (string, error) // PrepareXFromTop prepares limit n amount of posts, based on their indexed representations, from the top of the index. PrepareXFromTop(timelineAccountID string, limit int) error - // WipeStatusFromTimeline completely removes a status and from the index and prepared posts of the given account ID - // - // The returned int indicates how many entries were removed. - WipeStatusFromTimeline(timelineAccountID string, statusID string) (int, error) - // WipeStatusFromAllTimelines removes the status from the index and prepared posts of all timelines + // Remove removes one status from the timeline of the given timelineAccountID + Remove(statusID string, timelineAccountID string) (int, error) + // WipeStatusFromAllTimelines removes one status from the index and prepared posts of all timelines WipeStatusFromAllTimelines(statusID string) error } @@ -177,12 +175,6 @@ func (m *manager) PrepareXFromTop(timelineAccountID string, limit int) error { return t.PrepareFromTop(limit) } -func (m *manager) WipeStatusFromTimeline(timelineAccountID string, statusID string) (int, error) { - t := m.getOrCreateTimeline(timelineAccountID) - - return t.Remove(statusID) -} - func (m *manager) WipeStatusFromAllTimelines(statusID string) error { errors := []string{} m.accountTimelines.Range(func(k interface{}, i interface{}) bool { @@ -195,7 +187,7 @@ func (m *manager) WipeStatusFromAllTimelines(statusID string) error { errors = append(errors, err.Error()) } - return false + return true }) var err error diff --git a/internal/timeline/remove.go b/internal/timeline/remove.go index 2f340d37b..8842c60cb 100644 --- a/internal/timeline/remove.go +++ b/internal/timeline/remove.go @@ -3,9 +3,16 @@ package timeline import ( "container/list" "errors" + + "github.com/sirupsen/logrus" ) func (t *timeline) Remove(statusID string) (int, error) { + l := t.log.WithFields(logrus.Fields{ + "func": "Remove", + "accountTimeline": t.accountID, + "statusID": statusID, + }) t.Lock() defer t.Unlock() var removed int @@ -19,6 +26,7 @@ func (t *timeline) Remove(statusID string) (int, error) { return removed, errors.New("Remove: could not parse e as a postIndexEntry") } if entry.statusID == statusID { + l.Debug("found status in postIndex") removeIndexes = append(removeIndexes, e) } } @@ -37,6 +45,7 @@ func (t *timeline) Remove(statusID string) (int, error) { return removed, errors.New("Remove: could not parse e as a preparedPostsEntry") } if entry.statusID == statusID { + l.Debug("found status in preparedPosts") removePrepared = append(removePrepared, e) } } @@ -46,5 +55,6 @@ func (t *timeline) Remove(statusID string) (int, error) { removed = removed + 1 } + l.Debugf("removed %d entries", removed) return removed, nil } |