summaryrefslogtreecommitdiff
path: root/internal/visibility/statusvisible.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-10-03 10:46:11 +0200
committerLibravatar GitHub <noreply@github.com>2022-10-03 10:46:11 +0200
commit56f53a2a6f85876485e2ae67d48b78b448caed6e (patch)
tree9bd8d3fcaffd515d3dc90ff22c6cee17e8d0b073 /internal/visibility/statusvisible.go
parent[feature] Enlarge active/hovered custom emojis in statuses (#877) (diff)
downloadgotosocial-56f53a2a6f85876485e2ae67d48b78b448caed6e.tar.xz
[performance] add user cache and database (#879)
* go fmt * add + use user cache and database * fix import * update tests * remove unused relation
Diffstat (limited to 'internal/visibility/statusvisible.go')
-rw-r--r--internal/visibility/statusvisible.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/visibility/statusvisible.go b/internal/visibility/statusvisible.go
index 15d8544ad..c62ebb0af 100644
--- a/internal/visibility/statusvisible.go
+++ b/internal/visibility/statusvisible.go
@@ -68,8 +68,8 @@ func (f *filter) StatusVisible(ctx context.Context, targetStatus *gtsmodel.Statu
// if the target user doesn't exist (anymore) then the status also shouldn't be visible
// note: we only do this for local users
if targetAccount.Domain == "" {
- targetUser := &gtsmodel.User{}
- if err := f.db.GetWhere(ctx, []db.Where{{Key: "account_id", Value: targetAccount.ID}}, targetUser); err != nil {
+ targetUser, err := f.db.GetUserByAccountID(ctx, targetAccount.ID)
+ if err != nil {
l.Debug("target user could not be selected")
if err == db.ErrNoEntries {
return false, nil
@@ -98,8 +98,8 @@ func (f *filter) StatusVisible(ctx context.Context, targetStatus *gtsmodel.Statu
// if the requesting user doesn't exist (anymore) then the status also shouldn't be visible
// note: we only do this for local users
if requestingAccount.Domain == "" {
- requestingUser := &gtsmodel.User{}
- if err := f.db.GetWhere(ctx, []db.Where{{Key: "account_id", Value: requestingAccount.ID}}, requestingUser); err != nil {
+ requestingUser, err := f.db.GetUserByAccountID(ctx, requestingAccount.ID)
+ if err != nil {
// if the requesting account is local but doesn't have a corresponding user in the db this is a problem
l.Debug("requesting user could not be selected")
if err == db.ErrNoEntries {