[bugfix] visibility caching and hometimeline (#1675)

* fix visibility caching to use correct type key

Signed-off-by: kim <grufwub@gmail.com>

* check for ID check > max possible ID

Signed-off-by: kim <grufwub@gmail.com>

* update home timeline code to include relevant threads to owner (e.g. between mutuals/follows)

Signed-off-by: kim <grufwub@gmail.com>

---------

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim
2023-04-06 16:11:25 +01:00
committed by GitHub
parent 3510454768
commit e46323c207
5 changed files with 110 additions and 26 deletions

View File

@@ -30,6 +30,8 @@ import (
// StatusHomeTimelineable checks if given status should be included on requester's public timeline. Primarily relying on status visibility to requester and the AP visibility setting, and ignoring conversation threads.
func (f *Filter) StatusPublicTimelineable(ctx context.Context, requester *gtsmodel.Account, status *gtsmodel.Status) (bool, error) {
const vtype = cache.VisibilityTypePublic
// By default we assume no auth.
requesterID := noauth
@@ -49,10 +51,10 @@ func (f *Filter) StatusPublicTimelineable(ctx context.Context, requester *gtsmod
return &cache.CachedVisibility{
ItemID: status.ID,
RequesterID: requesterID,
Type: cache.VisibilityTypePublic,
Type: vtype,
Value: visible,
}, nil
}, "public", requesterID, status.ID)
}, vtype, requesterID, status.ID)
if err != nil {
if err == cache.SentinelError {
// Filter-out our temporary
@@ -103,7 +105,7 @@ func (f *Filter) isStatusPublicTimelineable(ctx context.Context, requester *gtsm
parentID,
)
if err != nil {
return false, fmt.Errorf("isStatusHomeTimelineable: error getting status parent %s: %w", parentID, err)
return false, fmt.Errorf("isStatusPublicTimelineable: error getting status parent %s: %w", parentID, err)
}
if parent.AccountID != status.AccountID {