summaryrefslogtreecommitdiff
path: root/internal/timeline/get.go
diff options
context:
space:
mode:
authorLibravatar Vyr Cossont <VyrCossont@users.noreply.github.com>2024-07-04 19:29:28 -0700
committerLibravatar GitHub <noreply@github.com>2024-07-04 19:29:28 -0700
commitbe5e532cd21fdbdfd1589186ed66a495ed5b8b35 (patch)
treed70eb05166f08225c484474bbef4bbbdc04bdf2b /internal/timeline/get.go
parent[feature] Set some security related headers (#3065) (diff)
downloadgotosocial-be5e532cd21fdbdfd1589186ed66a495ed5b8b35.tar.xz
[bugfix] Handle ErrHideStatus when preparing timeline statuses (#3071)
Diffstat (limited to 'internal/timeline/get.go')
-rw-r--r--internal/timeline/get.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/timeline/get.go b/internal/timeline/get.go
index 93c869e73..06ee8c174 100644
--- a/internal/timeline/get.go
+++ b/internal/timeline/get.go
@@ -25,6 +25,7 @@ import (
"codeberg.org/gruf/go-kv"
"github.com/superseriousbusiness/gotosocial/internal/db"
+ statusfilter "github.com/superseriousbusiness/gotosocial/internal/filter/status"
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/id"
"github.com/superseriousbusiness/gotosocial/internal/log"
@@ -246,6 +247,12 @@ func (t *timeline) getXBetweenIDs(ctx context.Context, amount int, behindID stri
// race condition? That's OK, we can do it now.
prepared, err := t.prepareFunction(ctx, t.timelineID, entry.itemID)
if err != nil {
+ if errors.Is(err, statusfilter.ErrHideStatus) {
+ // This item has been filtered out by the requesting user's filters.
+ // Remove it and skip past it.
+ removeElements = append(removeElements, e)
+ return true, nil
+ }
if errors.Is(err, db.ErrNoEntries) {
// ErrNoEntries means something has been deleted,
// so we'll likely not be able to ever prepare this.
@@ -340,6 +347,12 @@ func (t *timeline) getXBetweenIDs(ctx context.Context, amount int, behindID stri
// race condition? That's OK, we can do it now.
prepared, err := t.prepareFunction(ctx, t.timelineID, entry.itemID)
if err != nil {
+ if errors.Is(err, statusfilter.ErrHideStatus) {
+ // This item has been filtered out by the requesting user's filters.
+ // Remove it and skip past it.
+ removeElements = append(removeElements, e)
+ continue
+ }
if errors.Is(err, db.ErrNoEntries) {
// ErrNoEntries means something has been deleted,
// so we'll likely not be able to ever prepare this.