Timeline improvements (#41)

Tidying up.
Parent/child statuses now display correctly in status/id/context.
This commit is contained in:
Tobi Smethurst
2021-06-17 18:02:33 +02:00
committed by GitHub
parent b4288f3c47
commit 82d9f88e42
39 changed files with 739 additions and 602 deletions

View File

@ -222,12 +222,7 @@ func (p *processor) AccountStatusesGet(authed *oauth.Auth, targetAccountID strin
}
for _, s := range statuses {
relevantAccounts, err := p.db.PullRelevantAccountsFromStatus(&s)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error getting relevant statuses: %s", err))
}
visible, err := p.db.StatusVisible(&s, authed.Account, relevantAccounts)
visible, err := p.filter.StatusVisible(&s, authed.Account)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error checking status visibility: %s", err))
}
@ -235,28 +230,7 @@ func (p *processor) AccountStatusesGet(authed *oauth.Auth, targetAccountID strin
continue
}
var boostedStatus *gtsmodel.Status
if s.BoostOfID != "" {
bs := &gtsmodel.Status{}
if err := p.db.GetByID(s.BoostOfID, bs); err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error getting boosted status: %s", err))
}
boostedRelevantAccounts, err := p.db.PullRelevantAccountsFromStatus(bs)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error getting relevant accounts from boosted status: %s", err))
}
boostedVisible, err := p.db.StatusVisible(bs, authed.Account, boostedRelevantAccounts)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error checking boosted status visibility: %s", err))
}
if boostedVisible {
boostedStatus = bs
}
}
apiStatus, err := p.tc.StatusToMasto(&s, targetAccount, authed.Account, relevantAccounts.BoostedAccount, relevantAccounts.ReplyToAccount, boostedStatus)
apiStatus, err := p.tc.StatusToMasto(&s, authed.Account)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error converting status to masto: %s", err))
}

View File

@ -223,6 +223,8 @@ func (p *processor) GetFediStatus(requestedUsername string, requestedStatusID st
return nil, gtserror.NewErrorNotAuthorized(err)
}
// authorize the request:
// 1. check if a block exists between the requester and the requestee
blocked, err := p.db.Blocked(requestedAccount.ID, requestingAccount.ID)
if err != nil {
return nil, gtserror.NewErrorInternalError(err)
@ -232,6 +234,7 @@ func (p *processor) GetFediStatus(requestedUsername string, requestedStatusID st
return nil, gtserror.NewErrorNotAuthorized(fmt.Errorf("block exists between accounts %s and %s", requestedAccount.ID, requestingAccount.ID))
}
// get the status out of the database here
s := &gtsmodel.Status{}
if err := p.db.GetWhere([]db.Where{
{Key: "id", Value: requestedStatusID},
@ -240,6 +243,15 @@ func (p *processor) GetFediStatus(requestedUsername string, requestedStatusID st
return nil, gtserror.NewErrorNotFound(fmt.Errorf("database error getting status with id %s and account id %s: %s", requestedStatusID, requestedAccount.ID, err))
}
visible, err := p.filter.StatusVisible(s, requestingAccount)
if err != nil {
return nil, gtserror.NewErrorInternalError(err)
}
if !visible {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("status with id %s not visible to user with id %s", s.ID, requestingAccount.ID))
}
// requester is authorized to view the status, so convert it to AP representation and serialize it
asStatus, err := p.tc.StatusToAS(s)
if err != nil {
return nil, gtserror.NewErrorInternalError(err)

View File

@ -83,6 +83,10 @@ func (p *processor) processFromClientAPI(clientMsg gtsmodel.FromClientAPI) error
return errors.New("boost was not parseable as *gtsmodel.Status")
}
if err := p.timelineStatus(boostWrapperStatus); err != nil {
return err
}
if err := p.notifyAnnounce(boostWrapperStatus); err != nil {
return err
}

View File

@ -255,12 +255,6 @@ func (p *processor) timelineStatus(status *gtsmodel.Status) error {
status.GTSAuthorAccount = a
}
// get all relevant accounts here once
relevantAccounts, err := p.db.PullRelevantAccountsFromStatus(status)
if err != nil {
return fmt.Errorf("timelineStatus: error getting relevant accounts from status: %s", err)
}
// get local followers of the account that posted the status
followers := []gtsmodel.Follow{}
if err := p.db.GetFollowersByAccountID(status.AccountID, &followers, true); err != nil {
@ -279,7 +273,7 @@ func (p *processor) timelineStatus(status *gtsmodel.Status) error {
errors := make(chan error, len(followers))
for _, f := range followers {
go p.timelineStatusForAccount(status, f.AccountID, relevantAccounts, errors, &wg)
go p.timelineStatusForAccount(status, f.AccountID, errors, &wg)
}
// read any errors that come in from the async functions
@ -306,29 +300,29 @@ func (p *processor) timelineStatus(status *gtsmodel.Status) error {
return nil
}
func (p *processor) timelineStatusForAccount(status *gtsmodel.Status, accountID string, relevantAccounts *gtsmodel.RelevantAccounts, errors chan error, wg *sync.WaitGroup) {
func (p *processor) timelineStatusForAccount(status *gtsmodel.Status, accountID string, errors chan error, wg *sync.WaitGroup) {
defer wg.Done()
// get the targetAccount
// get the timeline owner account
timelineAccount := &gtsmodel.Account{}
if err := p.db.GetByID(accountID, timelineAccount); err != nil {
errors <- fmt.Errorf("timelineStatus: error getting account for timeline with id %s: %s", accountID, err)
errors <- fmt.Errorf("timelineStatusForAccount: error getting account for timeline with id %s: %s", accountID, err)
return
}
// make sure the status is visible
visible, err := p.db.StatusVisible(status, timelineAccount, relevantAccounts)
// make sure the status is timelineable
timelineable, err := p.filter.StatusHometimelineable(status, timelineAccount)
if err != nil {
errors <- fmt.Errorf("timelineStatus: error getting visibility for status for timeline with id %s: %s", accountID, err)
errors <- fmt.Errorf("timelineStatusForAccount: error getting timelineability for status for timeline with id %s: %s", accountID, err)
return
}
if !visible {
if !timelineable {
return
}
if err := p.timelineManager.IngestAndPrepare(status, timelineAccount.ID); err != nil {
errors <- fmt.Errorf("initTimelineFor: error ingesting status %s: %s", status.ID, err)
errors <- fmt.Errorf("timelineStatusForAccount: error ingesting status %s: %s", status.ID, err)
}
}

View File

@ -121,6 +121,10 @@ func (p *processor) processFromFederator(federatorMsg gtsmodel.FromFederator) er
}
}
if err := p.timelineStatus(incomingAnnounce); err != nil {
return err
}
if err := p.notifyAnnounce(incomingAnnounce); err != nil {
return err
}

View File

@ -35,6 +35,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/processing/synchronous/status"
"github.com/superseriousbusiness/gotosocial/internal/timeline"
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
"github.com/superseriousbusiness/gotosocial/internal/visibility"
)
// Processor should be passed to api modules (see internal/apimodule/...). It is used for
@ -185,6 +186,7 @@ type processor struct {
storage blob.Storage
timelineManager timeline.Manager
db db.DB
filter visibility.Filter
/*
SUB-PROCESSORS
@ -214,6 +216,7 @@ func NewProcessor(config *config.Config, tc typeutils.TypeConverter, federator f
storage: storage,
timelineManager: timelineManager,
db: db,
filter: visibility.NewFilter(db, log),
statusProcessor: statusProcessor,
}

View File

@ -106,15 +106,11 @@ func (p *processor) SearchGet(authed *oauth.Auth, searchQuery *apimodel.SearchQu
continue
}
relevantAccounts, err := p.db.PullRelevantAccountsFromStatus(foundStatus)
if err != nil {
continue
}
if visible, err := p.db.StatusVisible(foundStatus, authed.Account, relevantAccounts); !visible || err != nil {
if visible, err := p.filter.StatusVisible(foundStatus, authed.Account); !visible || err != nil {
continue
}
statusMasto, err := p.tc.StatusToMasto(foundStatus, statusOwner, authed.Account, relevantAccounts.BoostedAccount, relevantAccounts.ReplyToAccount, nil)
statusMasto, err := p.tc.StatusToMasto(foundStatus, authed.Account)
if err != nil {
continue
}

View File

@ -24,14 +24,8 @@ func (p *processor) Boost(account *gtsmodel.Account, application *gtsmodel.Appli
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error fetching target account %s: %s", targetStatus.AccountID, err))
}
l.Trace("going to get relevant accounts")
relevantAccounts, err := p.db.PullRelevantAccountsFromStatus(targetStatus)
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error fetching related accounts for status %s: %s", targetStatusID, err))
}
l.Trace("going to see if status is visible")
visible, err := p.db.StatusVisible(targetStatus, account, relevantAccounts)
visible, err := p.filter.StatusVisible(targetStatus, account)
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error seeing if status %s is visible: %s", targetStatus.ID, err))
}
@ -70,7 +64,7 @@ func (p *processor) Boost(account *gtsmodel.Account, application *gtsmodel.Appli
}
// return the frontend representation of the new status to the submitter
mastoStatus, err := p.tc.StatusToMasto(boostWrapperStatus, account, account, targetAccount, nil, targetStatus)
mastoStatus, err := p.tc.StatusToMasto(boostWrapperStatus, account)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error converting status %s to frontend representation: %s", targetStatus.ID, err))
}

View File

@ -24,14 +24,8 @@ func (p *processor) BoostedBy(account *gtsmodel.Account, targetStatusID string)
return nil, gtserror.NewErrorNotFound(fmt.Errorf("StatusBoostedBy: error fetching target account %s: %s", targetStatus.AccountID, err))
}
l.Trace("going to get relevant accounts")
relevantAccounts, err := p.db.PullRelevantAccountsFromStatus(targetStatus)
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("StatusBoostedBy: error fetching related accounts for status %s: %s", targetStatusID, err))
}
l.Trace("going to see if status is visible")
visible, err := p.db.StatusVisible(targetStatus, account, relevantAccounts)
visible, err := p.filter.StatusVisible(targetStatus, account)
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("StatusBoostedBy: error seeing if status %s is visible: %s", targetStatus.ID, err))
}

View File

@ -1,14 +1,69 @@
package status
import (
"fmt"
"sort"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
)
func (p *processor) Context(account *gtsmodel.Account, targetStatusID string) (*apimodel.Context, gtserror.WithCode) {
return &apimodel.Context{
context := &apimodel.Context{
Ancestors: []apimodel.Status{},
Descendants: []apimodel.Status{},
}, nil
}
targetStatus := &gtsmodel.Status{}
if err := p.db.GetByID(targetStatusID, targetStatus); err != nil {
if _, ok := err.(db.ErrNoEntries); ok {
return nil, gtserror.NewErrorNotFound(err)
}
return nil, gtserror.NewErrorInternalError(err)
}
visible, err := p.filter.StatusVisible(targetStatus, account)
if err != nil {
return nil, gtserror.NewErrorNotFound(err)
}
if !visible {
return nil, gtserror.NewErrorForbidden(fmt.Errorf("account with id %s does not have permission to view status %s", account.ID, targetStatusID))
}
parents, err := p.db.StatusParents(targetStatus)
if err != nil {
return nil, gtserror.NewErrorInternalError(err)
}
for _, status := range parents {
if v, err := p.filter.StatusVisible(status, account); err == nil && v {
mastoStatus, err := p.tc.StatusToMasto(status, account)
if err == nil {
context.Ancestors = append(context.Ancestors, *mastoStatus)
}
}
}
sort.Slice(context.Ancestors, func(i int, j int) bool {
return context.Ancestors[i].ID < context.Ancestors[j].ID
})
children, err := p.db.StatusChildren(targetStatus)
if err != nil {
return nil, gtserror.NewErrorInternalError(err)
}
for _, status := range children {
if v, err := p.filter.StatusVisible(status, account); err == nil && v {
mastoStatus, err := p.tc.StatusToMasto(status, account)
if err == nil {
context.Descendants = append(context.Descendants, *mastoStatus)
}
}
}
return context, nil
}

View File

@ -28,6 +28,7 @@ func (p *processor) Create(account *gtsmodel.Account, application *gtsmodel.Appl
UpdatedAt: time.Now(),
Local: true,
AccountID: account.ID,
AccountURI: account.URI,
ContentWarning: form.SpoilerText,
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
Sensitive: form.Sensitive,
@ -96,7 +97,7 @@ func (p *processor) Create(account *gtsmodel.Account, application *gtsmodel.Appl
}
// return the frontend representation of the new status to the submitter
mastoStatus, err := p.tc.StatusToMasto(newStatus, account, account, nil, newStatus.GTSReplyToAccount, nil)
mastoStatus, err := p.tc.StatusToMasto(newStatus, account)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error converting status %s to frontend representation: %s", newStatus.ID, err))
}

View File

@ -26,12 +26,6 @@ func (p *processor) Delete(account *gtsmodel.Account, targetStatusID string) (*a
return nil, gtserror.NewErrorForbidden(errors.New("status doesn't belong to requesting account"))
}
l.Trace("going to get relevant accounts")
relevantAccounts, err := p.db.PullRelevantAccountsFromStatus(targetStatus)
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error fetching related accounts for status %s: %s", targetStatusID, err))
}
var boostOfStatus *gtsmodel.Status
if targetStatus.BoostOfID != "" {
boostOfStatus = &gtsmodel.Status{}
@ -40,7 +34,7 @@ func (p *processor) Delete(account *gtsmodel.Account, targetStatusID string) (*a
}
}
mastoStatus, err := p.tc.StatusToMasto(targetStatus, account, account, relevantAccounts.BoostedAccount, relevantAccounts.ReplyToAccount, boostOfStatus)
mastoStatus, err := p.tc.StatusToMasto(targetStatus, account)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error converting status %s to frontend representation: %s", targetStatus.ID, err))
}

View File

@ -26,12 +26,6 @@ func (p *processor) Fave(account *gtsmodel.Account, targetStatusID string) (*api
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error fetching target account %s: %s", targetStatus.AccountID, err))
}
l.Trace("going to get relevant accounts")
relevantAccounts, err := p.db.PullRelevantAccountsFromStatus(targetStatus)
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error fetching related accounts for status %s: %s", targetStatusID, err))
}
var boostOfStatus *gtsmodel.Status
if targetStatus.BoostOfID != "" {
boostOfStatus = &gtsmodel.Status{}
@ -41,7 +35,7 @@ func (p *processor) Fave(account *gtsmodel.Account, targetStatusID string) (*api
}
l.Trace("going to see if status is visible")
visible, err := p.db.StatusVisible(targetStatus, account, relevantAccounts) // requestingAccount might well be nil here, but StatusVisible knows how to take care of that
visible, err := p.filter.StatusVisible(targetStatus, account) // requestingAccount might well be nil here, but StatusVisible knows how to take care of that
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error seeing if status %s is visible: %s", targetStatus.ID, err))
}
@ -98,7 +92,7 @@ func (p *processor) Fave(account *gtsmodel.Account, targetStatusID string) (*api
}
// return the mastodon representation of the target status
mastoStatus, err := p.tc.StatusToMasto(targetStatus, targetAccount, account, relevantAccounts.BoostedAccount, relevantAccounts.ReplyToAccount, boostOfStatus)
mastoStatus, err := p.tc.StatusToMasto(targetStatus, account)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error converting status %s to frontend representation: %s", targetStatus.ID, err))
}

View File

@ -24,14 +24,8 @@ func (p *processor) FavedBy(account *gtsmodel.Account, targetStatusID string) ([
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error fetching target account %s: %s", targetStatus.AccountID, err))
}
l.Trace("going to get relevant accounts")
relevantAccounts, err := p.db.PullRelevantAccountsFromStatus(targetStatus)
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error fetching related accounts for status %s: %s", targetStatusID, err))
}
l.Trace("going to see if status is visible")
visible, err := p.db.StatusVisible(targetStatus, account, relevantAccounts) // requestingAccount might well be nil here, but StatusVisible knows how to take care of that
visible, err := p.filter.StatusVisible(targetStatus, account)
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error seeing if status %s is visible: %s", targetStatus.ID, err))
}

View File

@ -24,14 +24,8 @@ func (p *processor) Get(account *gtsmodel.Account, targetStatusID string) (*apim
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error fetching target account %s: %s", targetStatus.AccountID, err))
}
l.Trace("going to get relevant accounts")
relevantAccounts, err := p.db.PullRelevantAccountsFromStatus(targetStatus)
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error fetching related accounts for status %s: %s", targetStatusID, err))
}
l.Trace("going to see if status is visible")
visible, err := p.db.StatusVisible(targetStatus, account, relevantAccounts) // requestingAccount might well be nil here, but StatusVisible knows how to take care of that
visible, err := p.filter.StatusVisible(targetStatus, account) // requestingAccount might well be nil here, but StatusVisible knows how to take care of that
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error seeing if status %s is visible: %s", targetStatus.ID, err))
}
@ -48,7 +42,7 @@ func (p *processor) Get(account *gtsmodel.Account, targetStatusID string) (*apim
}
}
mastoStatus, err := p.tc.StatusToMasto(targetStatus, targetAccount, account, relevantAccounts.BoostedAccount, relevantAccounts.ReplyToAccount, boostOfStatus)
mastoStatus, err := p.tc.StatusToMasto(targetStatus, account)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error converting status %s to frontend representation: %s", targetStatus.ID, err))
}

View File

@ -8,6 +8,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
"github.com/superseriousbusiness/gotosocial/internal/visibility"
)
// Processor wraps a bunch of functions for processing statuses.
@ -36,6 +37,7 @@ type processor struct {
tc typeutils.TypeConverter
config *config.Config
db db.DB
filter visibility.Filter
fromClientAPI chan gtsmodel.FromClientAPI
log *logrus.Logger
}
@ -46,6 +48,7 @@ func New(db db.DB, tc typeutils.TypeConverter, config *config.Config, fromClient
tc: tc,
config: config,
db: db,
filter: visibility.NewFilter(db, log),
fromClientAPI: fromClientAPI,
log: log,
}

View File

@ -24,14 +24,8 @@ func (p *processor) Unfave(account *gtsmodel.Account, targetStatusID string) (*a
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error fetching target account %s: %s", targetStatus.AccountID, err))
}
l.Trace("going to get relevant accounts")
relevantAccounts, err := p.db.PullRelevantAccountsFromStatus(targetStatus)
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error fetching related accounts for status %s: %s", targetStatusID, err))
}
l.Trace("going to see if status is visible")
visible, err := p.db.StatusVisible(targetStatus, account, relevantAccounts) // requestingAccount might well be nil here, but StatusVisible knows how to take care of that
visible, err := p.filter.StatusVisible(targetStatus, account)
if err != nil {
return nil, gtserror.NewErrorNotFound(fmt.Errorf("error seeing if status %s is visible: %s", targetStatus.ID, err))
}
@ -74,16 +68,7 @@ func (p *processor) Unfave(account *gtsmodel.Account, targetStatusID string) (*a
}
}
// return the status (whatever its state) back to the caller
var boostOfStatus *gtsmodel.Status
if targetStatus.BoostOfID != "" {
boostOfStatus = &gtsmodel.Status{}
if err := p.db.GetByID(targetStatus.BoostOfID, boostOfStatus); err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error fetching boosted status %s: %s", targetStatus.BoostOfID, err))
}
}
mastoStatus, err := p.tc.StatusToMasto(targetStatus, targetAccount, account, relevantAccounts.BoostedAccount, relevantAccounts.ReplyToAccount, boostOfStatus)
mastoStatus, err := p.tc.StatusToMasto(targetStatus, account)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("error converting status %s to frontend representation: %s", targetStatus.ID, err))
}

View File

@ -94,47 +94,15 @@ func (p *processor) filterStatuses(authed *oauth.Auth, statuses []*gtsmodel.Stat
return nil, gtserror.NewErrorInternalError(fmt.Errorf("HomeTimelineGet: error getting status author: %s", err))
}
relevantAccounts, err := p.db.PullRelevantAccountsFromStatus(s)
if err != nil {
l.Debugf("skipping status %s because we couldn't pull relevant accounts from the db", s.ID)
continue
}
visible, err := p.db.StatusVisible(s, authed.Account, relevantAccounts)
timelineable, err := p.filter.StatusHometimelineable(s, authed.Account)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("HomeTimelineGet: error checking status visibility: %s", err))
}
if !visible {
if !timelineable {
continue
}
var boostedStatus *gtsmodel.Status
if s.BoostOfID != "" {
bs := &gtsmodel.Status{}
if err := p.db.GetByID(s.BoostOfID, bs); err != nil {
if _, ok := err.(db.ErrNoEntries); ok {
l.Debugf("skipping status %s because status %s can't be found in the db", s.ID, s.BoostOfID)
continue
}
return nil, gtserror.NewErrorInternalError(fmt.Errorf("HomeTimelineGet: error getting boosted status: %s", err))
}
boostedRelevantAccounts, err := p.db.PullRelevantAccountsFromStatus(bs)
if err != nil {
l.Debugf("skipping status %s because we couldn't pull relevant accounts from the db", s.ID)
continue
}
boostedVisible, err := p.db.StatusVisible(bs, authed.Account, boostedRelevantAccounts)
if err != nil {
return nil, gtserror.NewErrorInternalError(fmt.Errorf("HomeTimelineGet: error checking boosted status visibility: %s", err))
}
if boostedVisible {
boostedStatus = bs
}
}
apiStatus, err := p.tc.StatusToMasto(s, targetAccount, authed.Account, relevantAccounts.BoostedAccount, relevantAccounts.ReplyToAccount, boostedStatus)
apiStatus, err := p.tc.StatusToMasto(s, authed.Account)
if err != nil {
l.Debugf("skipping status %s because it couldn't be converted to its mastodon representation: %s", s.ID, err)
continue
@ -227,17 +195,12 @@ func (p *processor) indexAndIngest(statuses []*gtsmodel.Status, timelineAccount
})
for _, s := range statuses {
relevantAccounts, err := p.db.PullRelevantAccountsFromStatus(s)
timelineable, err := p.filter.StatusHometimelineable(s, timelineAccount)
if err != nil {
l.Error(fmt.Errorf("initTimelineFor: error getting relevant accounts from status %s: %s", s.ID, err))
l.Error(fmt.Errorf("initTimelineFor: error checking home timelineability of status %s: %s", s.ID, err))
continue
}
visible, err := p.db.StatusVisible(s, timelineAccount, relevantAccounts)
if err != nil {
l.Error(fmt.Errorf("initTimelineFor: error checking visibility of status %s: %s", s.ID, err))
continue
}
if visible {
if timelineable {
if err := p.timelineManager.Ingest(s, timelineAccount.ID); err != nil {
l.Error(fmt.Errorf("initTimelineFor: error ingesting status %s: %s", s.ID, err))
continue