mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 01:02:25 -06:00
don't return on status filter errors, these are usually transient
This commit is contained in:
parent
acba53a354
commit
c6df3f610d
6 changed files with 41 additions and 49 deletions
|
|
@ -25,6 +25,7 @@ import (
|
|||
statusfilter "github.com/superseriousbusiness/gotosocial/internal/filter/status"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/log"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/paging"
|
||||
)
|
||||
|
||||
|
|
@ -83,11 +84,14 @@ func (p *Processor) HomeTimelineGet(
|
|||
|
||||
// Pre-filtering function,
|
||||
// i.e. filter before caching.
|
||||
func(s *gtsmodel.Status) (bool, error) {
|
||||
func(s *gtsmodel.Status) bool {
|
||||
|
||||
// Check the visibility of passed status to requesting user.
|
||||
ok, err := p.visFilter.StatusHomeTimelineable(ctx, requester, s)
|
||||
return !ok, err
|
||||
if err != nil {
|
||||
log.Errorf(ctx, "error filtering status %s: %v", s.URI, err)
|
||||
}
|
||||
return !ok
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/gtscontext"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/log"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/paging"
|
||||
)
|
||||
|
||||
|
|
@ -96,11 +97,14 @@ func (p *Processor) ListTimelineGet(
|
|||
|
||||
// Filtering function,
|
||||
// i.e. filter before caching.
|
||||
func(s *gtsmodel.Status) (bool, error) {
|
||||
func(s *gtsmodel.Status) bool {
|
||||
|
||||
// Check the visibility of passed status to requesting user.
|
||||
ok, err := p.visFilter.StatusHomeTimelineable(ctx, requester, s)
|
||||
return !ok, err
|
||||
if err != nil {
|
||||
log.Errorf(ctx, "error filtering status %s: %v", s.URI, err)
|
||||
}
|
||||
return !ok
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import (
|
|||
statusfilter "github.com/superseriousbusiness/gotosocial/internal/filter/status"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/log"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/paging"
|
||||
)
|
||||
|
||||
|
|
@ -87,11 +88,14 @@ func (p *Processor) publicTimelineGet(
|
|||
|
||||
// Pre-filtering function,
|
||||
// i.e. filter before caching.
|
||||
func(s *gtsmodel.Status) (bool, error) {
|
||||
func(s *gtsmodel.Status) bool {
|
||||
|
||||
// Check the visibility of passed status to requesting user.
|
||||
ok, err := p.visFilter.StatusPublicTimelineable(ctx, requester, s)
|
||||
return !ok, err
|
||||
if err != nil {
|
||||
log.Errorf(ctx, "error filtering status %s: %v", s.URI, err)
|
||||
}
|
||||
return !ok
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -136,11 +140,14 @@ func (p *Processor) localTimelineGet(
|
|||
|
||||
// Filtering function,
|
||||
// i.e. filter before caching.
|
||||
func(s *gtsmodel.Status) (bool, error) {
|
||||
func(s *gtsmodel.Status) bool {
|
||||
|
||||
// Check the visibility of passed status to requesting user.
|
||||
ok, err := p.visFilter.StatusPublicTimelineable(ctx, requester, s)
|
||||
return !ok, err
|
||||
if err != nil {
|
||||
log.Errorf(ctx, "error filtering status %s: %v", s.URI, err)
|
||||
}
|
||||
return !ok
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import (
|
|||
statusfilter "github.com/superseriousbusiness/gotosocial/internal/filter/status"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/log"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/paging"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/text"
|
||||
)
|
||||
|
|
@ -95,11 +96,14 @@ func (p *Processor) TagTimelineGet(
|
|||
|
||||
// Filtering function,
|
||||
// i.e. filter before caching.
|
||||
func(s *gtsmodel.Status) (bool, error) {
|
||||
func(s *gtsmodel.Status) bool {
|
||||
|
||||
// Check the visibility of passed status to requesting user.
|
||||
ok, err := p.visFilter.StatusHomeTimelineable(ctx, requester, s)
|
||||
return !ok, err
|
||||
if err != nil {
|
||||
log.Errorf(ctx, "error filtering status %s: %v", s.URI, err)
|
||||
}
|
||||
return !ok
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ func (p *Processor) getStatusTimeline(
|
|||
pageQuery url.Values,
|
||||
filterCtx statusfilter.FilterContext,
|
||||
loadPage func(*paging.Page) (statuses []*gtsmodel.Status, err error),
|
||||
filter func(*gtsmodel.Status) (bool, error),
|
||||
filter func(*gtsmodel.Status) (delete bool),
|
||||
) (
|
||||
*apimodel.PageableResponse,
|
||||
gtserror.WithCode,
|
||||
|
|
@ -80,7 +80,6 @@ func (p *Processor) getStatusTimeline(
|
|||
var mutes *usermute.CompiledUserMuteList
|
||||
|
||||
if requester != nil {
|
||||
|
||||
// Fetch all filters relevant for requesting account.
|
||||
filters, err = p.state.DB.GetFiltersForAccountID(ctx,
|
||||
requester.ID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue