From cec29e2a8d2d6ca49bb6c789f0ed3226849a7359 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Wed, 2 Aug 2023 09:31:09 +0200 Subject: [bugfix] Allow instance accounts to be shown in search results in certain circumstances (#2053) --- internal/visibility/account.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'internal/visibility/account.go') diff --git a/internal/visibility/account.go b/internal/visibility/account.go index 6c7a0059d..4d42b5973 100644 --- a/internal/visibility/account.go +++ b/internal/visibility/account.go @@ -19,10 +19,10 @@ package visibility import ( "context" - "fmt" "github.com/superseriousbusiness/gotosocial/internal/cache" "github.com/superseriousbusiness/gotosocial/internal/config" + "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/log" ) @@ -66,7 +66,7 @@ func (f *Filter) isAccountVisibleTo(ctx context.Context, requester *gtsmodel.Acc // Check whether target account is visible to anyone. visible, err := f.isAccountVisible(ctx, account) if err != nil { - return false, fmt.Errorf("isAccountVisibleTo: error checking account %s visibility: %w", account.ID, err) + return false, gtserror.Newf("error checking account %s visibility: %w", account.ID, err) } if !visible { @@ -83,7 +83,7 @@ func (f *Filter) isAccountVisibleTo(ctx context.Context, requester *gtsmodel.Acc // If requester is not visible, they cannot *see* either. visible, err = f.isAccountVisible(ctx, requester) if err != nil { - return false, fmt.Errorf("isAccountVisibleTo: error checking account %s visibility: %w", account.ID, err) + return false, gtserror.Newf("error checking account %s visibility: %w", account.ID, err) } if !visible { @@ -97,7 +97,7 @@ func (f *Filter) isAccountVisibleTo(ctx context.Context, requester *gtsmodel.Acc account.ID, ) if err != nil { - return false, fmt.Errorf("isAccountVisibleTo: error checking account blocks: %w", err) + return false, gtserror.Newf("error checking account blocks: %w", err) } if blocked { @@ -121,6 +121,7 @@ func (f *Filter) isAccountVisible(ctx context.Context, account *gtsmodel.Account // Fetch the local user model for this account. user, err := f.state.DB.GetUserByAccountID(ctx, account.ID) if err != nil { + err := gtserror.Newf("db error getting user for account %s: %w", account.ID, err) return false, err } -- cgit v1.2.3